Skip to main content

load_snapshot

Function load_snapshot 

Source
pub fn load_snapshot(path: &Path) -> Result<MaterializedState>
Expand description

Load a snapshot, refusing anything this build cannot read (§5.5, D-043).

The header is checked before the payload is decompressed, and a mismatch is DbError::SnapshotIncompatible rather than a corruption error, because the two want opposite responses: corruption is a fault to report, an incompatible snapshot is an ordinary consequence of upgrading and the right answer is to discard it and cold-fold. Distinguishing them is the whole point of the header — bincode is not self-describing, so without one an old file does not reliably fail to parse, it parses into wrong values.

Headerless files written by 0.5.4 and earlier are rejected by the same path: their first four bytes are zstd’s magic, which is not MACR.