def undo_reference(self, data, handle, db_map): """ Helper method to undo a reference map entry """ try: if data is None: db_map.delete(handle, txn=self.txn) else: db_map.put(handle, data, txn=self.txn) except DBERRS as msg: self.db._log_error() raise DbError(msg)
def undo_data(self, data, handle, db_map): """ Helper method to undo/redo the changes made """ try: if data is None: db_map.delete(handle, txn=self.txn) else: db_map.put(handle, data, txn=self.txn) except DBERRS as msg: self.db._log_error() raise DbError(msg)
def try_(self, *args, **kwargs): try: with BSDDBTxn(self.db.env) as txn: self.txn = self.db.txn = txn.txn status = func(self, *args, **kwargs) if not status: txn.abort() self.db.txn = None return status except DBERRS as msg: self.db._log_error() raise DbError(msg)
def undo_signals(self, data, handle, db_map, emit, signal_root): """ Helper method to undo/redo the changes made """ try: if data is None: emit(signal_root + '-delete', ([handle.decode('utf-8')],)) else: ex_data = db_map.get(handle, txn=self.txn) if ex_data: signal = signal_root + '-update' else: signal = signal_root + '-add' emit(signal, ([handle.decode('utf-8')],)) except DBERRS as msg: self.db._log_error() raise DbError(msg)