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:
objectOne
DeviceProvider’s PC/PS disk listing/assembly — resolvescopy_target_version→copy_target_file→file_meta(FORMAT-SPEC.md: version-meta-mapping) into disk nodes, and assembles a disk’s fragments into one realContentSourceonly 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 registeredfidthat never resolved infile_metaat 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 vialocate_file(), open its composition, and read its real extent (CompositionRecord.extent), combined into oneVirtualDiskContentSource. 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
selfby(disk_uuid, disk_index)— safe to hand the same frozenRestorableUnitto more than one caller — so a secondunit()call on the same disk skips straight to the cachedRestorableUnit. 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.