synology_apm_repo.sdk.identifiers module

Distinct identifier spaces that look identical on the wire (all int or all str) but must never be mixed.

Declaring each as a typing.NewType costs nothing at runtime — these are plain int/str at the bytes level — and turns “silently read the wrong repository file because two same-shaped identifiers got swapped” from a support incident into a mypy error, since mypy --strict is already enabled for this project.

class synology_apm_repo.sdk.identifiers.StreamId

ChunkAddress / composition-path stream id (0-255, uint8).

alias of int

class synology_apm_repo.sdk.identifiers.SessionId

Composition-path session id — one per backup version within a stream.

alias of int

class synology_apm_repo.sdk.identifiers.CompOffset

db/file_map.comp_offset — the global offset of a RecordHead within a (StreamId, SessionId) composition.

alias of int

class synology_apm_repo.sdk.identifiers.BucketId

Pool bucket id (0..2**40-1) — part of ChunkAddress.

alias of int

class synology_apm_repo.sdk.identifiers.ChunkIdx

Index of a 4 KiB chunk within a bucket (0..8191) — part of ChunkAddress.

alias of int

class synology_apm_repo.sdk.identifiers.ConnectionId

db/connection_config.connection_id — 12-char id identifying a Copy / Tiering connection. NOT the same space as ConnectionConfigId.

alias of str

class synology_apm_repo.sdk.identifiers.ConnectionConfigId

db/connection_config.connection_config_id — the local autoincrement primary key for a connection and version_type pair.

alias of int

class synology_apm_repo.sdk.identifiers.CatalogId

Repository Layer identifier for one api.Catalog — part of the Session/Repository/Catalog split that CLI/TUI code imports directly, with everything below that split treated as an implementation detail — distinct from every id above in that it’s not a raw on-disk column: a vault’s own catalogs share one connection_config table (unique within that vault, so str(connection_config_id) alone identifies one), but each object-storage sibling’s own connection_config table independently starts back at 1 — a bare connection_config_id can’t tell two siblings apart. For a vault, this is str(connection.connection_config_id); for object storage, the repo-id string itself (already unique per bucket by construction, being a directory name).

alias of str

synology_apm_repo.sdk.identifiers.resolve_catalog_id(repo_id, connection_config_id)

The one shared place holding the CatalogId fallback formula — repo_id when set (object storage), else str(connection_config_id) (a vault) — used both by api.catalog.Catalog.catalog_id and units.node_ref.canonical_ref_for, which would otherwise each carry an identical, independently-drifting copy of this fallback.

class synology_apm_repo.sdk.identifiers.WorkloadId

db/workload_config.workload_id — local autoincrement primary key.

alias of int

class synology_apm_repo.sdk.identifiers.WorkloadUid

db/workload_config.workload_uid — "<uuid>;<serial>" composite.

alias of str

class synology_apm_repo.sdk.identifiers.VersionId

db/copy_target_version.version_id — local autoincrement primary key.

alias of int

class synology_apm_repo.sdk.identifiers.SaasVersionId

copy_target_version.saas_version_id / saas_version.version_info.version_id — a SaaS stream’s own, per-stream version numbering (resolved via (snapshot_id, SaasVersionId) -> stream_version, units/saas/stream.py). NOT the same space as VersionId above — both are int, and catalog.Version carries one of each.

alias of int

class synology_apm_repo.sdk.identifiers.VersionUid

db/copy_target_version.version_uid — the Copy-version UUID minted server-side; forms copy_meta_file/<Type>_<VersionUid>. NOT the same space as target.db’s on-prem-minted version_table.version_uuid.

alias of str

class synology_apm_repo.sdk.identifiers.SnapshotUuid

saas_snapshot.snapshot_info.snapshot_uuid — server-minted snapshot id.

alias of str

class synology_apm_repo.sdk.identifiers.TargetId

db/copy_target_version.target_id — the on-prem workload UUID (device workloads) or stream uuid (SaaS).

alias of str

class synology_apm_repo.sdk.identifiers.StreamUuid

SaaS dedup-stream uuid (16 chars) — saas/<ccid>/<StreamUuid>/.

alias of str