#[non_exhaustive]pub enum IntegrityFailure {
ChecksumMismatch {
page_id: u64,
},
OrphanPage {
page_id: u64,
},
OrphanIndexEntry {
collection: String,
index: String,
id: u64,
},
MissingIndexEntry {
collection: String,
index: String,
id: u64,
},
BTreeSortViolation {
page_id: u64,
},
BTreeSiblingChainBroken {
tree: String,
page_id: u64,
},
BTreeDepthExceeded {
tree: String,
limit: usize,
},
BTreeLevelInvariantViolated {
tree: String,
page_id: u64,
},
DanglingCatalogPointer {
collection: String,
index: Option<String>,
page_id: u64,
},
FreelistChainBroken {
page_id: u64,
},
}Expand description
Categorical reasons an integrity walk records a failure. Every variant carries the locus of the problem (page id, collection, index name, document id) so an operator can root-cause without re-running the check.
The integrity walker accumulates a Vec<IntegrityFailure> and
returns it inside an IntegrityReport — every failure here is
recoverable in the sense that the check completed; the
caller decides whether to repair the file or refuse to open it.
I/O failures during the walk surface as an outer Result::Err
instead (the walk could not finish).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ChecksumMismatch
A page’s CRC32C trailer did not verify. The page-id is the
locus; page 0 would be a header CRC failure (the file
header carries its own CRC, not a page trailer — this
variant is emitted for any page whose trailer fails the
per-page integrity check).
OrphanPage
A page in 1..page_count is not reachable from any root the
walker recognises (catalog, freelist, any primary or index
B-tree). Indicates either a leaked page (allocated, never
linked) or a corrupted root pointer somewhere upstream.
OrphanIndexEntry
An index B-tree entry references a primary id that does NOT exist in the collection’s primary B-tree. Indicates the index is out-of-sync (likely a partial write that survived recovery, or a forensic mutation outside obj).
Fields
MissingIndexEntry
A primary B-tree entry has no matching entry in one of the
collection’s Active indexes. The walker checks the
per-index (id-suffix-or-value → at-least-one-entry)
invariant; an Each index with an empty sequence is NOT
reported (legal: the doc contributes no keys). For
Standard / Unique / Composite the absence of any
matching entry is a violation.
Fields
BTreeSortViolation
A B+tree node failed the sort invariant: a key was followed by a strictly-lesser-or-equal key inside the same node.
BTreeSiblingChainBroken
A B+tree’s child-pointer graph contains a cycle — the same
page is reachable as the child of two distinct ancestors (or
of itself). The tree field names the containing B-tree by
a human-readable label ("catalog",
"primary:<collection>", "index:<collection>.<index>").
Historically this variant also covered leaf next_sibling
chain breakage; the chain check was removed in M11 because
CoW deliberately leaves left-neighbour next_sibling
pointers stale (see crates/obj-core/src/btree/range.rs
lines 16-31). The variant name is preserved for compatibility
— it now signals only the descent-graph cycle path.
Fields
BTreeDepthExceeded
A B+tree’s depth exceeded
crate::btree::MAX_BTREE_DEPTH. Indicates a runaway tree
shape — by construction the obj writer cannot produce one;
surfacing here means the file was mutated outside obj.
Fields
BTreeLevelInvariantViolated
A B+tree node’s level value was inconsistent with its
kind — leaves must be level 0, internals strictly positive,
and the level must decrease by exactly 1 when descending
from an internal node to its child.
Fields
DanglingCatalogPointer
A CollectionDescriptor carried a primary_root or
IndexDescriptor.root_page_id that does not point at a
page id in 1..page_count — the catalog references a page
the file does not contain.
Fields
FreelistChainBroken
The freelist chain was broken — a next link pointed at a
non-freelist page (or a freelist page failed to decode), at
a page id past page_count, or the chain looped.
Trait Implementations§
Source§impl Clone for IntegrityFailure
impl Clone for IntegrityFailure
Source§fn clone(&self) -> IntegrityFailure
fn clone(&self) -> IntegrityFailure
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IntegrityFailure
impl Debug for IntegrityFailure
Source§impl PartialEq for IntegrityFailure
impl PartialEq for IntegrityFailure
Source§fn eq(&self, other: &IntegrityFailure) -> bool
fn eq(&self, other: &IntegrityFailure) -> bool
self and other values to be equal, and is used by ==.