Source code for cadrumo.application.live.verify_ports
"""Application-owned persistence port for live verification observations.The verify use case needs only bucket-scoped observation reads and writes. Theouter composition supplies the implementation that encrypts, envelopes, andindexes those observations; none of those storage details belong in thismodule or in :mod:`cadrumo.application.live.verify`."""from__future__importannotationsfromtypingimportTYPE_CHECKING,ProtocolifTYPE_CHECKING:from.verifyimportVerifyObservation
[docs]classVerifyObservationPersistencePort(Protocol):"""Persist and retrieve application-level verify observations by bucket. Implementations own storage encryption, envelope/schema validation, namespace selection, natural-key addressing, and translation of backend failures into the application's error vocabulary. The port deliberately exposes no storage record, envelope, namespace, SQL, or crypto type. """
[docs]defload(self,*,bucket_id:str,observation_id:str,)->VerifyObservation|None:"""Return one observation by its full content id, or ``None`` when absent."""...
[docs]deflist_observations(self,*,bucket_id:str,)->tuple[VerifyObservation,...]:"""Return every observation in ``bucket_id`` in deterministic capture order."""...
[docs]defsave(self,observation:VerifyObservation)->None:"""Persist one observation under its application-owned bucket and id."""...