Class SnapshotParticipant<S>
java.lang.Object
fr.robie.machineengine.api.transfer.SnapshotParticipant<S>
- Type Parameters:
S- an immutable snapshot of the participant's state
- Direct Known Subclasses:
SingleVariantStorage
Base class for state that takes part in transactions (ARCHITECTURE.md ยง10.2). Call
updateSnapshots(TransactionContext) before every change; the state is restored from the
snapshot if the transaction aborts.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Sprotected voidCalled once the outer transaction committed changes made to this participant.protected abstract voidreadSnapshot(S snapshot) Restores state captured bycreateSnapshot().final voidupdateSnapshots(@NotNull TransactionContext transaction) Must be called before modifying state insidetransaction.
-
Constructor Details
-
SnapshotParticipant
public SnapshotParticipant()
-
-
Method Details
-
createSnapshot
- Returns:
- an immutable copy of the current state
-
readSnapshot
Restores state captured bycreateSnapshot(). -
onFinalCommit
protected void onFinalCommit()Called once the outer transaction committed changes made to this participant. -
updateSnapshots
Must be called before modifying state insidetransaction.
-