Source code for cadrumo.domain.modelos.work_unit_repository
"""Public repository contract for the modelo work-unit catalogue."""from__future__importannotationsfromtypingimportTYPE_CHECKING,Protocol,runtime_checkablefrom.work_unitimportWorkUnitCatalogueifTYPE_CHECKING:fromcollections.abcimportCallablefrom...core.secure_object_writeimportSecureObjectWrite
[docs]@runtime_checkableclassWorkUnitCatalogueRepositoryProtocol(Protocol):"""Narrow domain-facing repository contract for the work-unit catalogue."""@propertydefbucket_id(self)->str|None:"""Return the profile bucket id when this repository resolved one."""...
[docs]defexists(self)->bool:"""Return whether a work-unit catalogue object has been persisted."""...
[docs]defload(self)->WorkUnitCatalogue:"""Return the persisted :class:`WorkUnitCatalogue` or an empty catalogue if absent."""...
[docs]defload_revisioned(self)->tuple[WorkUnitCatalogue,str]:"""Return the catalogue together with its current persistence revision."""...
[docs]defsave(self,catalogue:WorkUnitCatalogue)->None:"""Persist ``catalogue`` as the encrypted singleton object."""...
[docs]defmutate(self,mutation:Callable[[WorkUnitCatalogue],WorkUnitCatalogue])->WorkUnitCatalogue:"""Apply ``mutation`` to the stored catalogue as one revision-guarded unit of work."""...
[docs]defsave_with_secure_object_writes(self,catalogue:WorkUnitCatalogue,extra_writes:tuple[SecureObjectWrite,...],*,expected_revision_id:str|None=None,)->None:"""Persist ``catalogue`` plus co-emitted secure-object writes atomically."""...
[docs]defto_secure_object_write(self,catalogue:WorkUnitCatalogue,*,expected_revision_id:str|None=None,)->SecureObjectWrite:"""Return the secure-object upsert for ``catalogue`` without committing it."""...