pub enum MountMode {
Full,
Verify,
HeadersOnly,
}Expand description
How much of the log to index when mounting.
Variants§
Full
Rebuild the full index — entry counts, timestamp ranges and bloom
filters — reading each sealed sector’s
SectorFooter where one is present and
valid, and scanning the sector body only where it is not.
Required for reads, and the default. Cost is one page read per sealed sector, so it is proportional to the sector count on a log this build wrote. It falls back to a body scan — proportional to the data stored — for the sector a crashed run left active, and for any sector whose footer is missing or fails to validate.
Because a footer records what was written rather than what is still
readable, this mode does not re-verify sealed entries and therefore
reports no corrupt_entries for the
sectors it took from a footer. Reads are unaffected: every entry a query
returns is CRC-checked when it is read. Use Verify to
check the whole medium at mount instead.
Verify
Scan every entry of every valid sector, ignoring footers.
Identical to Full in what it produces, and the only mode
that re-verifies stored data at mount: the index is built from entries
whose CRCs pass now, and
corrupt_entries counts the rest. Cost is
proportional to the data stored, so a large nearly-full medium can take
seconds on a slow bus.
This is what Full did before sectors carried footers.
HeadersOnly
Read sector headers only, plus a full scan of the single highest-sequence sector so appends can resume at the right offset.
Bloom filters, per-sector entry counts and timestamp ranges are not
rebuilt, so latest, oldest,
count and query_range
return Error::ReadsUnavailable. Streaming via
read_from still works.
Now that sealed sectors carry footers, Full costs one
page read per sector where this costs one header read, so the gap is
small on a log this build wrote. What HeadersOnly still guarantees is
that the cost is O(sector_count) unconditionally — it never falls
back to a body scan, whatever state the medium is in. That is the reason
to keep reaching for it on a write-only replica read elsewhere.