aeat.adapters.outbound.storage._mirror_manifest module

Remote ciphertext mirror manifest construction, persistence, and inspection.

This module converts adapters.persistence.storage.sql.secure_objects.SecureObjectRawRow records into RemoteMirrorNamespaceManifest payloads, stores those payloads through StorageProvider under REMOTE_MIRROR_MANIFEST_NAMESPACE, and reports mirror drift as RemoteMirrorInspection records. Google sync uses the inspection helpers to distinguish partial uploads, partial downloads, stale mirrors, and revision conflicts without exposing plaintext secure-object payloads.

build_remote_mirror_namespace_manifest(namespace, rows)[source]

Build a RemoteMirrorNamespaceManifest for one ciphertext namespace.

Only rows whose adapters.persistence.storage.sql.secure_objects.SecureObjectRawRow namespace matches namespace are included. Each row becomes a RemoteMirrorObjectManifest, and the latest revision watermark is derived from the newest revision_written_at among those entries.

Return type:

RemoteMirrorNamespaceManifest

Parameters:
put_remote_mirror_namespace_manifest(provider, manifest)[source]

Persist manifest through provider and return its metadata.

The manifest JSON is written as an object in REMOTE_MIRROR_MANIFEST_NAMESPACE with a core.hashing.sha256_hex() content hash.

Return type:

ProviderObjectMetadata

Returns:

The provider’s ProviderObjectMetadata for the manifest object.

Parameters:
get_remote_mirror_namespace_manifest(provider, namespace)[source]

Return the stored RemoteMirrorNamespaceManifest for namespace.

Missing manifest objects return None. Malformed manifest payloads are translated to OutboundStorageIntegrityError so callers can handle them through the adapters.outbound.storage.OutboundStorageError hierarchy.

Return type:

RemoteMirrorNamespaceManifest | None

Parameters:
inspect_remote_mirror_upload(provider, expected_manifest)[source]

Detect remote upload drift for the expected namespace manifest.

Return type:

RemoteMirrorInspection

Returns:

A RemoteMirrorInspection describing the drift between the expected manifest and the remote mirror. Issues use RemoteMirrorIssueKind values such as PARTIAL_UPLOAD, STALE_MIRROR, and REVISION_CONFLICT.

Parameters:
inspect_remote_mirror_download(provider, remote_manifest)[source]

Inspect whether every object in remote_manifest is downloadable.

Missing objects, unreadable objects, integrity failures, and provider metadata drift are reported as PARTIAL_DOWNLOAD issues on the returned RemoteMirrorInspection.

Return type:

RemoteMirrorInspection

Parameters:
compare_remote_mirror_manifests(*, local, remote)[source]

Compare two namespace manifests and return a RemoteMirrorInspection.

The comparison classifies absent entries, stale remote revisions, and divergent revision lineages as RemoteMirrorIssue records.

Return type:

RemoteMirrorInspection

Parameters:
remote_mirror_object_key_hmac(namespace, object_key)[source]

Compute the provider object key used for mirrored ciphertext rows.

The digest combines the logical namespace and the raw secure-object object_key bytes so the remote provider sees only deterministic ciphertext object identifiers.

Return type:

str

Parameters: