cadrumo.adapters.persistence.operations.financial_operand_custody module

Durable filesystem custody checkpoints for transient financial operands.

The store holds one versioned checkpoint per wait and nothing more. Checkpoints are non-sensitive by construction - the operand contract keeps every amount out of the record - so this is an ordinary durable file rather than encrypted secure storage, which is the same posture the owner lease takes.

Every advance is a compare-and-swap under an exclusive lock. Two supervisor paths that both believe they should release one wait will both present the same predecessor; the first swap wins and the second is refused, so the buffer is cleared once.

class OperationFinancialOperandCustodyFilesystemRepository(*, root=None, settings=None)[source]

Bases: OperationFinancialOperandCustodyRepository

One durable checkpoint per wait, advanced only by compare-and-swap.

Parameters:
  • root (Path | None)

  • settings (Settings | None)

async read(interaction_id)[source]

Return the latest checkpoint for one wait, or None if never opened.

Return type:

OperationFinancialOperandCustodyCheckpoint | None

Parameters:

interaction_id (str)

async open(checkpoint)[source]

Record the opening checkpoint, refusing a wait that already exists.

Return type:

None

Parameters:

checkpoint (OperationFinancialOperandCustodyCheckpoint)

async advance(predecessor, successor)[source]

Replace predecessor with successor only if it is still current.

Return type:

None

Parameters:
async unsettled()[source]

Return every wait left in a non-terminal state, for restart reconciliation.

Return type:

tuple[OperationFinancialOperandCustodyCheckpoint, ...]