synology_apm_repo.sdk.units.content.pcps_disk module¶
VirtualDiskContentSource reassembles a PC/PS physical disk’s
per-region dedup objects (“fragments”, FORMAT-SPEC.md: PC/PS disk fragments) into one
ContentSource that behaves like a single disk image.
Two facts it depends on: a fragment’s chunk-map offsets are
disk-absolute, so its DedupFile opened with the whole disk’s size is
already a correctly-sparse whole-disk view; and db/file_meta.file_size
is the whole disk’s capacity, not one fragment’s length (that comes from
CompositionRecord.extent).
- class synology_apm_repo.sdk.units.content.pcps_disk.DiskFragment(fid, start, end, dedup_file, src_file_path)¶
Bases:
objectOne PC/PS per-region object, resolved to a ready-to-read
DedupFileand the disk-absolute[start, end)its composition covers (CompositionRecord.extent).
- class synology_apm_repo.sdk.units.content.pcps_disk.VirtualDiskContentSource(size, fragments)¶
Bases:
objectA PC/PS physical disk’s fragments as one
ContentSourcespanning[0, size).Fragments overlap in real data: a fragment’s composition covers whole 4096-byte chunks, so the chunk straddling a region boundary can hold real data in the later region while the earlier one pads it with a
ZEROdeclaration. Where more than one fragment covers a byte, the one with the higherstartwins. The disk is split once into disjoint winning segments (_winning_segments) thatreadandexport_rangeboth use, so neither depends on write order.- async read(offset=0, length=None)¶
ContentSource.read; a request pastsizeis clamped.
- stream(block=8388608)¶
- async export_range(writer, start, end, *, sparse=True, progress=None, tuning=None)¶
Exports the disk’s
[start, end)intowriterat offsets relative tostart, one winning segment at a time, so overlaps are neither written nor counted twice. Gaps between fragments are holes: left unwritten whensparse=Trueand the writer allows it, zero-filled otherwise.- Raises:
ValueError – The range is not inside the disk.
- pool_descriptor()¶
How a worker process rebuilds the fragments’
Pool:Noneunless every fragment’s file is backed by the same rebuildable one.
- async planned_bytes(start, end)¶