synology_apm_repo.sdk.diagnostics module¶
Repository Layer sibling — raw, catalog-bypassing inspection of one
physical file, addressed by a bare store-relative path rather than a
NodeRef. For forensics tooling (the CLI’s dump command family) that
needs “what does this byte layout actually say” for one
.buk/composition/chunk-map file outside any discovered repository —
the same Codec/Dedup Layer parsers the real read path uses, wrapped here
so CLI/TUI code never imports format/storage/dedup internals
directly for this. Every function here takes an already-resolved
ObjectStore rather than opening one itself — the CLI decides local vs.
--profile and hands in whichever store applies; open_local() is
only the local-path adapter it uses for its own local case.
Deliberately out of scope: resolving a .<N> sequence-id suffix
(FORMAT-SPEC.md: sequence-id-suffix) from a logical name — callers pass
the literal on-disk filename, local or remote, the same way they always
have.
- synology_apm_repo.sdk.diagnostics.mode_flags(mode)¶
Bucket-header
modebits as their names — bit→string is format knowledge, not a CLI rendering concern.
- synology_apm_repo.sdk.diagnostics.open_local(path)¶
Split a literal local file path into an
ObjectStorerooted at the parent directory plus the bare filename — the CLI’s own adapter for its local (non---profile) case, so the actual reads still go through the storage layer, the same as every--profile-resolved remote store, rather than a second, ad hocopen()call here.
- class synology_apm_repo.sdk.diagnostics.ChunkEntryInspection(index, compress_type, stored_len, effective_len, offset, length)¶
Bases:
objectOne
--chunk-selected entry’s own fields, nested underBucketInspectionwhen a specific chunk was asked for.
- 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.- chunk: ChunkEntryInspection | None = 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:
IndexError –
chunkis out of range for this bucket’s own entry count.
- 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 own fields, mirroring
ChunkMapEntryInspection’s shape one section down:map_crc_okholds a real bool only whenverify_mapwas given (set by_walk_composition_records), stayingNoneotherwise.
- class synology_apm_repo.sdk.diagnostics.CompositionWalk(path, header, records, next_offset, file_size, stopped_with_error=None)¶
Bases:
objectwalk_composition’s result: the header (if the file starts with one —subID=0only), every record walked up tolimit, the offset walking stopped at, and — only when the walk stopped because a record failed to parse partway through, not because it reachedlimit/the file’s end — that failure’s message.- records: list[CompositionRecordInspection]¶
- async synology_apm_repo.sdk.diagnostics.walk_composition(store, rel, *, offset=None, limit=10, verify_map=False)¶
Walk composition records in
rel— the header, if present (subID=0only), plus up tolimitrecords starting atoffset(default: right after the header, or byte 0 for a non-subID=0file).Raises the underlying
ApmRepoErrorwhen nothing at all could be parsed (no header, and the record walk failed before it collected even one record); a failure partway through an otherwise-successful walk is reported in the returnedCompositionWalk’sstopped_with_errorinstead.
- class synology_apm_repo.sdk.diagnostics.ChunkMapAddrInspection(stream_id, bucket_id, chunk_idx)¶
Bases:
objectA
MAPPINGchunk-map entry’s resolved chunk address — which stream, bucket, and chunk index it points at.
- class synology_apm_repo.sdk.diagnostics.ChunkMapEntryInspection(index, kind, file_offset, end_offset, is_inherit, map_num, repeat, addr=None)¶
Bases:
objectOne
ChunkMapRecordentry —addronly carries a real value for aChunkMapKind.MAPPINGrecord; every other kind leaves itNone.- addr: ChunkMapAddrInspection | None = None¶
- class synology_apm_repo.sdk.diagnostics.ChunkMapInspection(path, head_off, map_num, map_crc_ok, entries)¶
Bases:
objectThe result of dumping one record’s
ChunkMapRecordarray — its own map-entry count, decoded entries, and (when checked) the mapCrc verdict.- entries: list[ChunkMapEntryInspection]¶
- async synology_apm_repo.sdk.diagnostics.inspect_chunk_map(store, rel, offset, *, limit=50, verify=False)¶
Dump the
ChunkMapRecordarray — the core read structure — of the record atoffset: each entry’s kind, file/end offsets, inherit flag, map number and repeat count, plus (withverify=True) the chunk-map CRC check result.