Skip to main content

read_pack

Function read_pack 

Source
pub fn read_pack(
    input: impl Read,
    sink: &mut dyn PackSink,
) -> Result<PackReadReport, StoreError>
Expand description

Consumes a SNAPPACK 1 stream from input, filing verified records into sink. See the module docs for the full invariant list; in short:

  • every record header is validated (magic, version, hex64, decimal len, MAX_HEADER_BYTES cap);
  • every payload is incrementally BLAKE3-hashed and must match its claimed checksum (mismatch ⇒ staged bytes discarded, whole stream aborted);
  • duplicate objects are verified-but-skipped (write-once);
  • the manifest (if any) must be the last record and is committed ONLY after the end trailer; EOF before end is a hard error and never commits the manifest.