synology_apm_repo.sdk.diagnostics module¶
Raw inspection of one physical .buk/composition/chunk-map file,
addressed by a store-relative path instead of a NodeRef and bypassing
the catalog, for forensics tooling such as the CLI’s dump commands. It
uses the same parsers as the read path, so callers need no
format/storage/dedup internals.
Every function takes an already-resolved ObjectStore (open_local()
builds one for a local path) and the literal on-disk filename: a .<N>
sequence-id suffix (FORMAT-SPEC.md: Sequence-id suffix mechanism) is not
resolved from a logical name.
- synology_apm_repo.sdk.diagnostics.mode_flags(mode)¶
Bucket-header
modebits as their names.
- synology_apm_repo.sdk.diagnostics.open_local(path)¶
A local file path as an
ObjectStorerooted at its parent directory plus the bare filename, for the functions here.
- class synology_apm_repo.sdk.diagnostics.ChunkEntryInspection(index, compress_type, stored_len, effective_len, offset, length)¶
Bases:
objectOne bucket entry’s fields, as
inspect_bucket’schunkselected it.
- class synology_apm_repo.sdk.diagnostics.BucketInspection(path, major, minor, mode, mode_flags, chunk_num, chunk_size_crc, compress_type_counts, expected_size, actual_size, size_check_ok, chunk=None)¶
Bases:
objectA
.bukfile’s header, SizeStore summary, and theexpected_bucket_sizeself-check.- expected_size: int | None¶
Nonefor the legacy uncompressed layout, which has noexpected_bucket_sizeformula;size_check_okisNonethen too.
- chunk: ChunkEntryInspection | None¶
- async synology_apm_repo.sdk.diagnostics.inspect_bucket(store, rel, *, chunk=None)¶
Inspect a
.bukfile’s header, SizeStore summary, andexpected_bucket_sizeself-check.- Raises:
NotFoundError –
reldoes not exist, orchunkis out of range for this bucket’s entry count.DataCorruptError – The header or SizeStore is corrupt and not repairable.
- class synology_apm_repo.sdk.diagnostics.CompositionRecordInspection(head_off, status, map_num, mode, has_redundancy, attr_leng, map_crc_ok=None)¶
Bases:
objectOne composition record’s fields;
map_crc_okisNoneunlesswalk_compositionwas asked toverify_map.
- class synology_apm_repo.sdk.diagnostics.CompositionWalk(path, header, records, next_offset, file_size, stopped_with_error=None)¶
Bases:
objectwalk_composition’s result.- Variables:
path (str) – The walked file, as
relnamed it.header (tuple[int, int] | None) – The composition header’s
(major, minor);Nonewhen the file has none (onlysubID=0does).records (list[synology_apm_repo.sdk.diagnostics.CompositionRecordInspection]) – The records walked, at most
limit.next_offset (int) – Where walking stopped.
file_size (int) – The file’s size, which bounds the walk.
stopped_with_error (str | None) – Why a record failed to parse, when that ended the walk before
limitor the end of the file.
- records: list[CompositionRecordInspection]¶
- async synology_apm_repo.sdk.diagnostics.walk_composition(store, rel, *, offset=None, limit=10, verify_map=False)¶
The composition header of
rel, if present, plus up tolimitrecords fromoffset(default: right after the header, else byte 0). A parse failure after something was parsed is reported instopped_with_error.- Raises:
ApmRepoError – Nothing could be parsed: no header, and not even one record.
- class synology_apm_repo.sdk.diagnostics.ChunkMapAddrInspection(stream_id, bucket_id, chunk_idx)¶
Bases:
objectA
MAPPINGchunk-map entry’s chunk address.
- class synology_apm_repo.sdk.diagnostics.ChunkMapEntryInspection(index, kind, file_offset, end_offset, is_inherit, map_num, repeat, addr=None)¶
Bases:
objectOne
ChunkMapRecordentry;addris set only for aChunkMapKind.MAPPINGentry.- addr: ChunkMapAddrInspection | None¶
- class synology_apm_repo.sdk.diagnostics.ChunkMapInspection(path, head_off, map_num, map_crc_ok, entries)¶
Bases:
objectinspect_chunk_map’s result: the record’s entry count, the decoded entries, and the map-CRC verdict when checked.- entries: list[ChunkMapEntryInspection]¶
- async synology_apm_repo.sdk.diagnostics.inspect_chunk_map(store, rel, offset, *, limit=50, verify=False)¶
The first
limitentries of theChunkMapRecordarray of the record atoffset, plus the chunk-map CRC verdict whenverifyis set.