Skip to main content

load_derived

Function load_derived 

Source
pub fn load_derived(
    db: &mut QueryDb,
    snapshot_sha256: [u8; 32],
    path: &Path,
    workspace_root: &Path,
) -> Result<LoadOutcome, LoadError>
Expand description

Load a derived file at path into a pristine [QueryDb].

§Staged-validation + infallible-commit contract (spec §5.7)

  1. Path validation happens before any file IO.
  2. All fallible work (file open, header decode, magic/version check, SHA match, entry stream decode) runs in the validation phase and returns Err(...) without touching the DB.
  3. Once all entries are staged successfully, [QueryDb::commit_staged_load] is called. That function is infallible by construction — it contains no ?, no Result-bearing call, and no map_err.
  4. After commit, cold_load_allowed is flipped to false to prevent a second load from overwriting the committed state.

§Errors