예제 #1
0
파일: states.py 프로젝트: yongming/kopf
 def purge(
         self,
         *,
         body: bodies.Body,
         patch: patches.Patch,
         storage: progress.ProgressStorage,
 ) -> None:
     # Purge only our own handlers. Ignore others (e.g. other operators).
     for handler_id in self.keys():
         storage.purge(key=handler_id, body=body, patch=patch)
     storage.flush()
예제 #2
0
파일: states.py 프로젝트: yongming/kopf
 def store(
         self,
         body: bodies.Body,
         patch: patches.Patch,
         storage: progress.ProgressStorage,
 ) -> None:
     for handler_id, handler_state in self.items():
         full_record = handler_state.for_storage()
         pure_record = handler_state.as_in_storage()
         if pure_record != handler_state._origin:
             storage.store(key=handler_id, record=full_record, body=body, patch=patch)
     storage.flush()
예제 #3
0
 def purge(
     self,
     *,
     body: bodies.Body,
     patch: patches.Patch,
     storage: progress.ProgressStorage,
 ) -> None:
     # Purge only our own handlers and their direct & indirect sub-handlers of all levels deep.
     # Ignore other handlers (e.g. handlers of other operators).
     for handler_id, handler_state in self.items():
         storage.purge(key=handler_id, body=body, patch=patch)
         for subref in handler_state.subrefs:
             storage.purge(key=subref, body=body, patch=patch)
     storage.flush()