Skip to main content

read_bundle_streaming_atomic

Function read_bundle_streaming_atomic 

Source
pub fn read_bundle_streaming_atomic<R, H>(
    src: R,
    stage_dir: &Path,
    on_head: H,
    restorer: &mut dyn BundleRestorer,
) -> Result<Vec<MemberSpec>, BundleError>
where R: Read, H: FnMut(bool, &SourceInfo),
Expand description

The v3-capable atomic single-pass reader — the inc2 superset of read_bundle_streaming_staged. Reads v1, v2 AND v3 bundles in one forward pass, dispatching each member to restorer by its MemberFraming: a Sidecar member is staged to a bounded temp under stage_dir and size/SHA-VERIFIED BEFORE restore_sidecar (verify-then-apply, unchanged from v2); a ChunkedTrailer member streams chunk-by-chunk through begin_chunked / write_chunk (the reader hashing + counting, NEVER staging the whole member) and is committed by finish_chunked ONLY when the TRAILING trailer matched — so a corrupt/truncated chunked member applies nothing (atomic). on_head(data_only, source) fires once after the MANIFEST, before any member. Enforces the v2/v3 declared order + per-member framing + the v1 completeness, exactly as [read_bundle_core].