Source code for cadrumo.adapters.persistence.profile.confirmation_records
"""Encrypted persistence adapter for ledger confirmation records."""from__future__importannotationsfromtypingimportoverridefrom....application.ledger.confirmation_recordimport(ConfirmationRecordDocument,confirmation_record_object_key,)from....core.configimportSettingsfrom..storage.envelope.secure_bound_repositoryimportSecureBoundRepositoryfrom..storage.runtime_repositoryimportsecure_object_repository_for_bucketfrom..storage.secure_object_namespacesimportLEDGER_CONFIRMATION_RECORD_NAMESPACE
[docs]classConfirmationRecordRepository(SecureBoundRepository[ConfirmationRecordDocument]):"""Store one bucket's confirmation provenance through encrypted objects."""namespace=LEDGER_CONFIRMATION_RECORD_NAMESPACE.namespacesensitivity=LEDGER_CONFIRMATION_RECORD_NAMESPACE.sensitivityschema_version=LEDGER_CONFIRMATION_RECORD_NAMESPACE.schema_versionpayload_type=ConfirmationRecordDocumentdef__init__(self,*,bucket_id:str,settings:Settings|None)->None:"""Bind the repository to ``bucket_id`` through the storage runtime."""super().__init__(objects=secure_object_repository_for_bucket(bucket_id,settings))
[docs]@overridedefextract_identifier(self,payload:ConfirmationRecordDocument)->str:"""Return the application-owned natural key for ``payload``."""returnconfirmation_record_object_key(payload)