Source code for cadrumo.application.ledger.counterparty_establishment_ports
"""Application-owned persistence capability for counterparty facts.The establishment policy owns the fact DTO and its conflict/resolution rules.Encrypted storage is supplied by an outer composition root through this narrowprotocol; storage-specific failures are translated by the adapter."""from__future__importannotationsfromtypingimportTYPE_CHECKING,Protocolfrom...core.errors.hierarchyimportCadrumoErrorifTYPE_CHECKING:from.counterparty_establishmentimportConfirmedCounterpartyFacts
[docs]classCounterpartyEstablishmentPersistenceError(CadrumoError):"""Translated failure from the counterparty-establishment store."""def__init__(self,operation:str)->None:"""Carry only the application operation, never storage details."""self.operation=operationsuper().__init__(f"counterparty establishment persistence operation failed: {operation}")
[docs]classCounterpartyEstablishmentRepositoryProtocol(Protocol):"""Required bucket-bound operations for remembered counterparty facts."""
[docs]defload(self,identifier:str)->ConfirmedCounterpartyFacts|None:"""Load one remembered fact, or return None when absent."""...
[docs]defsave(self,payload:ConfirmedCounterpartyFacts)->None:"""Persist one validated remembered fact."""...
[docs]defdelete(self,identifier:str)->bool:"""Delete one remembered fact and report whether it existed."""...
[docs]classCounterpartyEstablishmentRepositoryFactory(Protocol):"""Construct the persistence capability for one profile bucket."""def__call__(self,*,bucket_id:str)->CounterpartyEstablishmentRepositoryProtocol:"""Return the capability bound to bucket_id."""...