DatastoreTransaction¶
- class lsst.daf.butler.datastore.DatastoreTransaction(parent: DatastoreTransaction | None = None)¶
Bases:
objectKeeps a log of
Datastoreactivity 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
undoWithblock.All arguments are forwarded directly to
registerUndo.- Parameters:
- name
str The name to associate with this event.
- undoFunc
Callable Function to undo this event.
- *args
tuple Positional arguments for
undoFunc.- **kwargs
typing.Any Keyword arguments for
undoFunc.
- name