Skip to main content

Module fsck

Module fsck 

Source
Expand description

fsck rules for a manifest/object graph.

Every rule has a name. A corrupt graph is not merely “invalid” — fsck says which invariant broke and at which node, because the operator response differs: a digest mismatch means the bytes are wrong, a dangling ref means publication tore, and an extent gap means a grant would authorize bytes nobody selected.

The rules divide into four families:

  1. Well-formed — every reachable node decodes canonically (FsckRule::MalformedNode, FsckRule::NonCanonicalNodeEncoding, FsckRule::LeafEntriesOutOfOrder, …).
  2. Digests match — node bytes hash to the address they were fetched by, subtree summaries equal what the subtree actually holds, and every encoded pack record hashes to its declared digest.
  3. No dangling refs — every branch child resolves, every leaf object is present in the object index, and no grant names an object the manifest does not cover.
  4. Gap-free coverage — a pack range’s records partition [start, end) exactly, in offset-canonical order, with no gap and no overlap.

fsck is checking, not repair, and it is total: it collects every finding rather than bailing at the first, so one run tells an operator the whole story. Traversal is still bounded — visited nodes are not re-entered and depth cannot exceed the fixed route — so an adversarial node set cannot make it spin.

Structs§

FsckFinding
One violation: the rule, where it was found, and a human-readable detail.
FsckOptions
What fsck should check beyond node structure.
FsckReport
Every finding from one fsck run.
PackRangeAudit
What to check a pack claim against, beyond its own structure.

Enums§

FsckRule
The named integrity rules fsck enforces.

Traits§

ManifestObjectIndex
The set of content objects a manifest may legally name, with their decoded sizes.

Functions§

fsck_manifest
Check a manifest graph rooted at root for structure and digests only.
fsck_manifest_store
Check every root in roots against a whole node store, additionally reporting nodes no root reaches.
fsck_manifest_with
Check a manifest graph rooted at root, with optional object and reachability checks.
fsck_pack_range
Check that a coalesced pack range is offset-canonical, gap-free, and — when the caller supplies them — digest-correct and manifest-covered.