synology_apm_repo.sdk.catalog.version module¶
Version: one db/copy_target_version row (+ _meta when
present), its own meta-availability checks, and open_target_db() — the
one place this layer does real decrypt work (shared by the Unit Layer’s
Device and FS providers). Display/status extraction
(_version_epoch/_version_display_name) is a first-class output here
too: CLI/TUI show only display_name/subtitle/attrs in the
default (non-diagnostic) mode, so this can’t be an afterthought bolted on
later.
Encrypted connections: version_spec itself is AES-256-CTR
ciphertext (whole-string, standard base64) whenever the connection has a
vault key, decrypted with the same DEK as chunk-pool/aHlT encryption
before parsing — see parse_version_spec, also used by
units.saas.object_name_index. Not documented in docs/ at all
(neither this column’s schema nor its encryption).
- class synology_apm_repo.sdk.catalog.version.VersionMeta(target_meta_path, meta_filenames, status)¶
Bases:
objectA version’s
_metasidecar, when present: its directory, the filenames it holds, and its own status code.
- class synology_apm_repo.sdk.catalog.version.Version(version_id, version_uid, workload_id, connection_config_id, target_type, target_id, saas_stream_uuid, saas_snapshot_uuid, saas_version_id, deleted, display_name, meta)¶
Bases:
objectOne
db/copy_target_versionrow (+_metawhen present).- version_uid: VersionUid¶
- workload_id: WorkloadId¶
- connection_config_id: ConnectionConfigId¶
- saas_stream_uuid: StreamUuid¶
- saas_snapshot_uuid: SnapshotUuid¶
- saas_version_id: SaasVersionId¶
- meta: VersionMeta | None¶
- synology_apm_repo.sdk.catalog.version.resolve_meta_filename(meta, name, *, ref=None)¶
Confirm
name(e.g."target.db") is one of this version’s ownmeta_filenames— thecopy_meta_file/<dir>directory’s authoritative, write-time-recorded file list (FORMAT-SPEC.md: version-meta-mapping) — and return it unchanged.Never a directory scan — unlike the dedup layer’s own per-generation files (
.buk,db/<name>, …; seestorage/seqid.py’sresolve_seq_file), files undercopy_meta_fileare written once by the backup agent and never rewritten by the dedup layer.- Raises:
NotFoundError –
namewas never registered for this version.
- synology_apm_repo.sdk.catalog.version.resolve_copy_meta_dir(version, repo_root)¶
The
copy_meta_file/<dir>this VM/FSversion’s own meta artifacts (target.db,version.db.zst) live under, derived fromcopy_target_version_meta.target_meta_pathjoined ontorepo_root(empty when a store is rooted directly at the vault dir, non-empty when the repository was discovered from a parent directory —Session.discover).- Raises:
NotFoundError –
versionhas nocopy_target_version_metarow at all (no meta directory ever landed for it).
- async synology_apm_repo.sdk.catalog.version.open_target_db(repo, version, meta_dir)¶
Resolve and open
<meta_dir>/target.dbinto an openedSqliteSource— the identical sequenceunits.deviceandunits.fseach need before going on to interprettarget.db’s own tables their own way. May beaHlT-enveloped and have a real-wal/-shmsidecar (FORMAT-SPEC.md: copy_meta_file-layout);SqliteSource. from_enveloped_storehandles both. A different addressing scheme thanDedupRepo.db’s owndb/<name>auto-detection (name-alias resolution plus generation-selection forOBJECT_STORE):copy_meta_fileentries are written once by the backup agent and never rotated, so this resolves the physical filename directly against the version’s own recordedmeta_filenamesinstead.rebuild_target.db(§6.4) is never read through this function.
- async synology_apm_repo.sdk.catalog.version.versions(repo, workload, *, include_deleted=False)¶
Newest-first by real backup time (
_version_epoch, the same field/fallback_version_display_nameuses, so sort order and displayed timestamp always agree).table.select()carries noORDER BYof its own — row order is an implementation detail, not a chronological guarantee — so sorting happens here. A version whose timestamp can’t be resolved sorts last, ties broken byversion_iddescending (the best available recency proxy once the real timestamp is unusable).
- class synology_apm_repo.sdk.catalog.version.ParsedVersionStatus(status=None, start_time=None, end_time=None)¶
Bases:
objectversion_spec.status, narrowed to exactly the fields_version_epoch/_version_display_name/the browsable-status filter (_BROWSABLE_VERSION_STATUSES) read — a type-checked replacement for passing a rawdict[str, Any]around, so mypy enforces “call_parse_version_statusfirst” as a real requirement instead of a documented-only convention. Field names matchversion_spec.status’s own JSON keys.
- synology_apm_repo.sdk.catalog.version.parse_version_spec(version_spec_raw, version_uid, vault_key)¶
Decrypt (whenever
vault_keyis given) and JSON-parse onecopy_target_version.version_speccolumn value — the shared decrypt-then-parse step this module’s own status filter andunits.saas.object_name_index’s connector-recorded index both need.Decrypts unconditionally whenever
vault_keyis given, never by probing the raw column first (§5.1: encryption is a per-connection state, not per-row).Returns
Noneon any failure — undecryptable or unparseable — never raises; each caller applies its own conservative default.