cadrumo.application.ledger.protocols module¶
Application-layer port protocols for the ledger service.
Defines structural typing.Protocol interfaces consumed by
cadrumo.application.ledger.actions_import so that the application layer
depends only on these protocol types, not on concrete adapter classes.
- class ParsedLedgerRowProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolStructural view of one parsed financial source row.
- property raw: RawTransaction¶
Return the domain raw transaction carried by this row.
- property direction: TransactionDirection¶
Return the authoritative flow direction for this row.
- class ProviderValidationProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolStructural validation result returned by a financial source port.
Optional-extra facts when the provider cannot run locally.
- class FinancialProviderProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol satisfied by any file-backed raw transaction provider.
Covers exactly the two methods called by the ledger import service:
ingest()andvalidate_source(). Adapter-internal helpers (build_provenance,_read_source_bytes, etc.) remain private to the adapter implementation.- ingest(path)[source]¶
Yield parsed ledger rows from
path.Each yielded item carries a magnitude
RawTransactionplus itsTransactionDirection, parsed from the provider-format file.- Return type:
- Parameters:
path (Path)
- class TransactionCatalogueCoCommitWriterProtocol(*args, **kwargs)[source]¶
Bases:
TransactionCatalogueRepositoryProtocol,ProtocolTransaction-catalogue port for an atomic multi-object ledger write.
- save_with_secure_object_writes(catalogue, extra_writes)[source]¶
Persist the catalogue and related secure objects atomically.
Core types:
TransactionCatalogue.- Return type:
- Parameters:
catalogue (TransactionCatalogue)
extra_writes (tuple[SecureObjectWrite, ...])
- class InvoiceCatalogueCoCommitWriterProtocol(*args, **kwargs)[source]¶
Bases:
InvoiceCatalogueRepositoryProtocol,ProtocolInvoice-catalogue port for an atomic ledger co-commit.
- load_revisioned()[source]¶
Load the catalogue with the secure-object revision observed.
- Return type:
- to_secure_object_write(catalogue, *, expected_revision_id=None)[source]¶
Build the invoice secure-object write without committing it.
Core types:
InvoiceCatalogue.- Return type:
- Parameters:
catalogue (InvoiceCatalogue)
expected_revision_id (str | None)