synology_apm_repo.sdk.units.device module

DeviceProvider: VM/PC/PS workloads via copy_meta_file.

The smallest backed-up unit for these workload types is a whole disk/volume image (FORMAT-SPEC.md: Landing directory layout); this provider’s disk-image leaves are exactly that. When a Dissect package is installed, every supported dedup disk image also gets one sibling node, “<name> (filesystem)”, built via units.device_disk_fs by parsing the guest filesystem inside the image with units.content.disk_fs. When no filesystem is recognized, that sibling is absent or shows one diagnostic leaf; the whole-image node is unaffected.

Two paths, dispatched directly on Version.target_type ("VM" vs {"PC", "PS"}), never by probing which files exist:

  • VM: target.db → version_table → device_table (one row per disk device) → object_table (one row per disk image, joined on config_device_id). Handled directly in this module.

  • PC/PS: no target.db, only snapshot_info.json. The disk list comes from db/copy_target_file (version_id → fid) joined with db/file_meta (fid → path), looked up in db/file_map. Handled by device_pcps.PcpsDiskTree, since one physical PC/PS disk can land as several fragment objects that need reassembling.

Trap: a PC/PS landing directory exists for every normally-landed version too, just without target.db — target_type is the only reliable dispatch signal.

class synology_apm_repo.sdk.units.device.DeviceProvider(repo, version)

Bases: AsyncClosing

ClosableUnitProvider for one VM/PC/PS workload version. Build one with create.

async classmethod create(repo, version)

Build a provider for version. No I/O happens here.

property repo: DedupRepo

For the PcpsDiskTree/DiskFsSibling collaborators.

property version: Version

For the PcpsDiskTree/DiskFsSibling collaborators.

property disk_fs: DiskFsSibling

The disk-fs sibling collaborator, through which PcpsDiskTree builds a PC/PS disk’s “(filesystem)” sibling node.

extra_ref(*extra)

This provider’s version ref with extra segments appended (never a nested repo_path, whose literal # would not survive NodeRef.parse()).

async close()

Close the target.db connection, if opened.

root()

The top node: “Disks” for PC/PS, “Devices” for VM. No I/O.

async children(node, offset=0, limit=None)
async unit(node)

Open node as a restorable unit.

Raises: