synology_apm_repo.sdk.units.device_pcps module

PcpsDiskTree: the PC/PS disk-fragment listing/assembly axis, split out of units/device.py’s DeviceProvider, which dispatches to it based on Version.target_type alone, never by probing which files exist.

PC/PS disk grouping: one physical disk can land as several independently-registered fragment objects, not one — see _pcps_disk_key() for the grouping rule and PcpsDiskTree.open_disk for reassembling a group’s fragments into one VirtualDiskContentSource.

class synology_apm_repo.sdk.units.device_pcps.PcpsDiskTree(provider)

Bases: object

One DeviceProvider’s PC/PS disk listing/assembly — resolves copy_target_version → copy_target_file → file_meta (FORMAT-SPEC.md: version-meta-mapping) into disk nodes, and assembles a disk’s fragments into one real ContentSource only when actually opened.

async object_nodes(*, offset=0, limit=None)

List this PC/PS version’s disks — see _build_nodes() for how they’re resolved. Any registered fid that never resolved in file_meta at all is summarized in one diagnostic node, appended on the first page only.

async open_disk(node)

Assemble one PC/PS disk’s fragments (deferred from _disk_nodes()): resolve each via locate_file(), open its composition, and read its real extent (CompositionRecord.extent), combined into one VirtualDiskContentSource. Fragments resolve independently and open concurrently.

A fragment that fails to resolve is recorded in attrs["diagnostic"] instead of failing the whole disk — reads landing in its range come back as an ordinary hole.

A successful assembly is cached on self by (disk_uuid, disk_index) — safe to hand the same frozen RestorableUnit to more than one caller — so a second unit() call on the same disk skips straight to the cached RestorableUnit. A failed assembly (every fragment unresolvable) is not cached and is retried from scratch on the next call.

Raises:

NotFoundError – Every fragment failed to resolve, so there is nothing to build a disk from.