DatastoreTransaction¶
- class lsst.daf.butler.datastore.DatastoreTransaction(parent: DatastoreTransaction | None = None)¶
Bases:
object
Keeps a log of
Datastore
activity and allow rollback.- Parameters:
- parent
DatastoreTransaction
, optional The parent transaction (if any)
- parent
Methods Summary
commit
()Commit this transaction.
registerUndo
(name, undoFunc, *args, **kwargs)Register event with undo function.
rollback
()Roll back all events in this transaction.
undoWith
(name, undoFunc, *args, **kwargs)Register undo function if nested operation succeeds.
Methods Documentation
- registerUndo(name: str, undoFunc: Callable, *args: Any, **kwargs: Any) None ¶
Register event with undo function.
- undoWith(name: str, undoFunc: Callable, *args: Any, **kwargs: Any) Iterator[None] ¶
Register undo function if nested operation succeeds.
Calls
registerUndo
.This can be used to wrap individual undo-able statements within a DatastoreTransaction block. Multiple statements that can fail separately should not be part of the same
undoWith
block.All arguments are forwarded directly to
registerUndo
.