synology_apm_repo.sdk.units.verify_extents module

Per-workload-type extent resolution for verify_reachable: turns a Version into the CompositionExtent``(s) its content actually lives in, reusing each workload type's own already-implemented resolution (``DeviceProvider/FsProvider/SaasStream) rather than re-deriving any path/SQL logic. Feeds into units.verify_reachable’s top-down walk, which runs FULL or QUICK checks (see VerifyLevel) against the buckets these extents resolve to.

class synology_apm_repo.sdk.units.verify_extents.CompositionExtent(dedup_file, start, end, unit_label)

Bases: object

One composition record’s byte range a Version’s own content lives in — [start, end) within dedup_file, which already exposes its own (stream_id, session_id, comp_offset) triple directly (DedupFile.stream_id/.session_id/.comp_offset), so this doesn’t duplicate those fields. A VM/FS/SaaS version has exactly one of these; a PC/PS version has one per disk fragment.

dedup_file: DedupFile
start: int
end: int
unit_label: str

For a Finding.path — e.g. "VM disk 'disk1.vmdk'", "PC/PS disk fragment fid=42".

async synology_apm_repo.sdk.units.verify_extents.composition_extents_for_version(repo, workload, version, saas_streams)

Every composition record this version’s own content lives in — one for a VM/FS/SaaS version’s single dedup image/stream, one per disk fragment for a PC/PS version. Reuses each workload type’s own, already-implemented resolution (DeviceProvider/FsProvider/ SaasStream via saas_streams, the exact machinery real browsing uses) rather than re-deriving any path/SQL logic — this function is a thin adapter over each, not a second implementation of “how does a version’s content resolve.” saas_streams is the caller’s own run-scoped SaasStreamCache (_ReachabilityWalker owns one) — GW/M365’s own forward-resolution caching (see units.saas.stream) only pays off when every version sharing a stream resolves through the same SaasStream instance, not a fresh one per call.

Deliberately does not recurse into a device version’s guest filesystem (DiskFsSibling) or a SaaS version’s individual Mail/Drive/Calendar items: both are byte-range/offset views into the same composition record(s) this function already returns, so walking them would only re-touch chunks already covered — a device provider’s own node tree is shallow (root → children already are the leaf disks).

Returns (extents, findings): a VM/PC-PS version has more than one disk/fragment, and one of them failing to resolve must not discard every other disk’s already-resolved content the same way every other stage in this module already treats a partial failure (see units.verify_reachable._ReachabilityWalker._discover_extent’s own chunk-map-walk except clause) — so a per-disk resolution failure is folded into findings instead of raised, and every other disk keeps its own place in extents. FS/SaaS always return an empty findings (a single dedup image/stream, nothing to be partial about).

Raises:

ApmRepoError – This version’s metadata claims it should resolve to real content but doesn’t resolve at all — the caller (verify_reachable) turns this into a Stage.VERSION Finding rather than silently skipping the version.