aeat.adapters.persistence.profile.buckets module¶
Encrypted SQL repository for the bucket-event-history catalogue.
BucketEventHistoryRepository persists
BucketEventHistoryCatalogue through
SecureObjectRepository, which
handles encrypted BLOB storage and key management for the active profile
bucket. Each stored record is wrapped in an
Envelope at
FINANCIAL SensitivityClass.
This concrete repository is the persistence adapter behind the read-side
BucketEventHistoryRepositoryProtocol. It lives in
the persistence adapter (not in buckets) because its
secure-object coupling is SQL/crypto-bound; the domain package owns only the
typed BucketEventHistoryCatalogue model, its
narrow port, and the
BucketEventHistoryPersistenceError boundary error.
The namespace/version constants are redeclared here as the persisted-envelope
contract; the strings are preserved to avoid orphaning persisted envelopes.
See also
bucketsPublic bucket-event facade that owns the catalogue, event taxonomy, and repository protocol.
BucketEventHistoryCatalogueDomain payload encrypted by this repository.
BucketEventHistoryRepositoryProtocolDomain port this concrete persistence adapter implements.
BUCKET_EVENT_HISTORY_NAMESPACECentral namespace, sensitivity, schema-version, and singleton-key contract for these secure objects.
secure_object_repository_for_active_bucket()Runtime storage factory used when no secure-object repository is injected.
bucket_maintenanceApplication lifecycle surface that records bucket-maintenance events through this repository.
- class BucketEventHistoryRepository(*, objects=None)[source]¶
Bases:
objectRepository over encrypted SQL-backed event-history catalogue storage.
BUCKET_EVENT_HISTORY_NAMESPACEis the central profile-local namespace, schema-version, sensitivity, and singleton-key contract for the encryptedBucketEventHistoryCatalogue. The catalogue preserves the append-onlyBucketEventhistory, is wrapped inEnvelope, and is persisted throughSecureObjectRepository. The same envelope can be emitted as aSecureObjectWritewhen sibling catalogue updates need one transaction. This class exposes the concrete load/save implementation behindBucketEventHistoryRepositoryProtocol.- Parameters:
objects (SecureObjectRepository | None)
- property secure_object_repository: SecureObjectRepository¶
Return the secure-object backend used by this catalogue.
- Returns:
The
SecureObjectRepositorybacking this repository.
- load()[source]¶
Return the persisted catalogue or an empty catalogue if absent.
- Return type:
- Returns:
The deserialised
BucketEventHistoryCatalogue, or a fresh empty instance when no database object is present.- Raises:
BucketEventHistoryPersistenceError – If secure-object classification, envelope version, or payload validation fails.
- save(catalogue)[source]¶
Persist
catalogueatomically through the secure-object repository.- Parameters:
catalogue (
BucketEventHistoryCatalogue) – TheBucketEventHistoryCatalogueto persist.- Return type:
- to_secure_object_write(catalogue)[source]¶
Return the secure-object upsert for
cataloguewithout committing it.The returned
SecureObjectWritecarries the sameEnvelopeandSensitivityClassclassification thatsave()would persist directly.- Return type:
- Parameters:
catalogue (BucketEventHistoryCatalogue)