cadrumo.application.operations.persistence.financial_operand_custody module¶
Durable custody-checkpoint persistence contract for financial operands.
The repository stores the checkpoints defined by the operand custody contract and nothing else. Its guarantee is narrow and load-bearing: an advance is accepted only when it follows the predecessor the caller actually observed, so two supervisor paths racing to settle one wait cannot both win.
That compare-and-swap is what makes release exactly-once at the durable layer rather than only in memory. The in-process transition table refuses an illegal move; this refuses a legal move applied twice.
See also
OperationFinancialOperandCustodyCheckpointThe non-sensitive record this contract persists and replays.
- exception OperationFinancialOperandCustodyConflictError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorRaised when a custody advance loses its compare-and-swap.
- Parameters:
- Return type:
None
- code¶
- class OperationFinancialOperandCustodyRepository(*args, **kwargs)[source]¶
Bases:
ProtocolPersist and replay one operand wait’s custody positions.
- async read(interaction_id)[source]¶
Return the latest checkpoint for one wait, or
Noneif never opened.- Return type:
- Parameters:
interaction_id (str)
- async open(checkpoint)[source]¶
Record the opening checkpoint, refusing a wait that already exists.
- Return type:
- Parameters:
checkpoint (OperationFinancialOperandCustodyCheckpoint)
- async advance(predecessor, successor)[source]¶
Replace
predecessorwithsuccessoronly if it is still current.- Raises:
OperationFinancialOperandCustodyConflictError – The stored checkpoint is no longer
predecessor, so another path already settled or advanced this wait.- Return type:
- Parameters:
predecessor (OperationFinancialOperandCustodyCheckpoint)
successor (OperationFinancialOperandCustodyCheckpoint)