Skip to main content

carve_with_fragments

Function carve_with_fragments 

Source
pub fn carve_with_fragments(db: &Database) -> CarveTiers
Expand description

Two-tier deleted-record recovery: Tier-1 full rows plus Tier-2 partial fragments, in one pass.

CarveTiers::full is byte-identical to carve_all_deleted_records (the high-precision, structurally-0-false-positive output). CarveTiers::fragments is the opt-in lead surface: at every freeblock/gap anchor where full reconstruction failed but ≥ 1 distinctive cell (TEXT ≥ 4 bytes of valid UTF-8, or REAL) survived, the maximal decodable column prefix is salvaged as a CarvedFragment. Three suppression layers keep the fragment bucket honest:

  1. By construction — a fragment is emitted only where full reconstruction failed, so an anchor yields a full cell or a fragment, never both.
  2. Full-row value suppression — a fragment whose every surviving (column, value) matches the corresponding column of a Tier-1 record in full is dropped (the row was already recovered another way).
  3. Live-row suppression — a fragment whose every surviving (column, value) matches the corresponding columns of a currently-live row is dropped (never re-surface a live row, the fragment analog of the rebalance-copy drop).

Read-only and panic-free, identically to carve_all_deleted_records.