Exemplo n.º 1
0
 def update_to(self, seq):
     pillow_logging.info(
         "(%s) setting checkpoint: %s" % (self.checkpoint_id, seq)
     )
     checkpoint = self.get_or_create(verify_unchanged=True).document
     checkpoint['seq'] = seq
     checkpoint['timestamp'] = get_formatted_current_timestamp()
     self._manager.update_checkpoint(self.checkpoint_id, checkpoint)
     self._last_checkpoint = checkpoint
Exemplo n.º 2
0
 def get_or_create_checkpoint(self, checkpoint_id):
     created = False
     try:
         checkpoint_doc = self._dao.get_document(checkpoint_id)
     except DocumentNotFoundError:
         checkpoint_doc = {'seq': '0', 'timestamp': get_formatted_current_timestamp()}
         self._dao.save_document(checkpoint_id, checkpoint_doc)
         created = True
     return DocGetOrCreateResult(checkpoint_doc, created)
Exemplo n.º 3
0
 def reset_checkpoint(self, checkpoint_id):
     checkpoint_doc = self.get_or_create_checkpoint(checkpoint_id).document
     checkpoint_doc['old_seq'] = checkpoint_doc['seq']
     checkpoint_doc['seq'] = '0'
     checkpoint_doc['timestamp'] = get_formatted_current_timestamp()
     self._dao.save_document(checkpoint_id, checkpoint_doc)