cadrumo.domain.buckets.protocols module¶
Domain-level repository Protocol for the bucket-event-history catalogue.
Application-layer code that persists or loads bucket event catalogues
depends on BucketEventHistoryRepositoryProtocol, not on the concrete
secure-object-backed BucketEventHistoryRepository. This keeps callers
typed against the narrow port while the concrete repository owns the adapter
integration.
BucketEventHistoryRepositoryProtocol abstracts exists / load /
save operations over BucketEventHistoryCatalogue, allowing
services to emit BucketEvent history without importing the concrete
BucketEventHistoryRepository.
- class BucketEventHistoryRepositoryProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolNarrow domain-facing repository contract for the bucket-event-history catalogue.
Any object that provides
exists,load, andsaveover a per-bucketBucketEventHistoryCataloguesatisfies this protocol. The production implementation isBucketEventHistoryRepository.- load()[source]¶
Return the persisted catalogue or an empty catalogue if absent.
- Return type:
- Returns:
The
BucketEventHistoryCatalogueloaded from storage.
- save(catalogue)[source]¶
Persist
cataloguein the encrypted database object store.- Parameters:
catalogue (
BucketEventHistoryCatalogue) – TheBucketEventHistoryCatalogueto persist.- Return type:
- to_secure_object_write(catalogue, *, expected_revision_id=None)[source]¶
Return the
SecureObjectWriteforcataloguewithout committing it.The port a caller uses to commit an event in the same unit of work as the state change it records: pair it with
build_bucket_event()andappend_bucket_event(), then pass the returned write to the owning catalogue repository’ssave_with_secure_object_writes.- Return type:
- Parameters:
catalogue (BucketEventHistoryCatalogue)
expected_revision_id (str | None)