pub fn walk_btree<F: FileBackend>(
pager: &mut Pager<F>,
ctx: &TreeContext,
reachable: &mut HashSet<PageId>,
failures: &mut Vec<IntegrityFailure>,
) -> Result<u64>Expand description
Walk a single B-tree from ctx.root, recording any per-node
invariant violations into failures and inserting every visited
node page-id into reachable. Returns the number of pages this
walk inspected.
The walk traverses the tree level by level via an explicit
Vec<PageId> queue and a HashSet<PageId> already-seen guard
(so a cycle introduced by an out-of-band mutation cannot
infinitely-loop the walker). Bounded by
MAX_RANGE_NODES per tree (Rule 2).
§Errors
Returns Error::Io on cache-miss read failure. Never returns
an Error::Corruption directly — corruption surfaces as a
IntegrityFailure entry in failures.