Source code for cadrumo.application.filing.history_ports
"""Application-owned persistence contract for local filing history.The filing-history service owns the payload and repository semantics. An outercomposition supplies the encrypted persistence capability through this module;the application surface never names the storage implementation or its errors.Core types::class:`~cadrumo.core.classification.policies.SensitivityClass`."""from__future__importannotationsfromcollections.abcimportIteratorfromdataclassesimportdataclassfrompathlibimportPathfromtypingimportFinal,Protocolfrom...core.classification.policiesimportSensitivityClassfrom.errorsimportModeloApplicationErrorfrom.history_modelsimportModeloHistoryFILING_HISTORY_NAMESPACE="cadrumo.application.filing.history"FILING_HISTORY_SENSITIVITY:Final[SensitivityClass]=SensitivityClass("audit")FILING_HISTORY_SCHEMA_VERSION=1
[docs]classFilingHistoryPersistenceError(ModeloApplicationError):"""Translated persistence failure for the filing-history boundary."""
[docs]classFilingHistoryRepositoryPort(Protocol):"""Bucket-bound filing-history persistence capability."""@propertydefstore_dir(self)->Path:"""Return the logical secure-store marker used for diagnostics."""...
[docs]defenvelope_path_for(self,identifier:str)->Path:"""Return the logical marker for one history identifier."""...
[docs]deflock_target_for(self,identifier:str)->Path:"""Return the logical lock marker for one history identifier."""...
[docs]defload(self,identifier:str)->ModeloHistory|None:"""Load one history, returning ``None`` when it is absent."""...
[docs]defsave(self,payload:ModeloHistory)->None:"""Persist one validated history payload."""...
[docs]defdelete(self,identifier:str)->bool:"""Delete one history and report whether it existed."""...
[docs]defiter_records(self)->Iterator[ModeloHistory]:"""Iterate all persisted history payloads with integrity checks."""...
[docs]@dataclass(frozen=True,slots=True)classFilingHistoryPorts:"""Required authorities for one bucket-local filing-history repository."""repository:FilingHistoryRepositoryPortbucket_id:str