pub struct Entry { /* private fields */ }Expand description
One archive entry: a tiling of chunks, each placed at its own
fdata_offset.
§Why this is a struct and not a trait
It was a trait — EntryReader, with two implementations that differed in
how they COMBINE: chunks concatenate, deltas apply. That difference is what
forced two of them, and it put the seam on the read side.
The seam belongs on the write side instead. A splitter decides how to cut
a file into stored units (see Splitter); a unit it may emit is a reference
to another entry. Reconstruction then stays exactly one loop — the loop below,
which is the pre-trait extract_inner code — and the recursion lives in
[ChunkSource].
What that buys, and it is the reason for the swap: a single file can be part
chunk and part delta. A large file with one changed region stores the changed
region as a delta and the rest as ordinary chunks. EntryReader was
all-or-nothing per entry and could not say that.
What it leaves alone: the read path, which is the half that is measured and
proven. chunked_reconstruction_is_byte_identical_to_the_pre_trait_implementation
pins that with one blake3 over a deterministic corpus, and that constant has
now survived both the trait’s arrival and its removal.
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn uncompressed_size(&self) -> u64
pub fn uncompressed_size(&self) -> u64
Size of the reconstructed entry in bytes, as the index declares it. Untrusted: never size an allocation from it.
Sourcepub fn reconstruct(
&self,
path: &str,
ctx: &ReconstructCtx<'_>,
verify: bool,
) -> Result<Vec<u8>>
pub fn reconstruct( &self, path: &str, ctx: &ReconstructCtx<'_>, verify: bool, ) -> Result<Vec<u8>>
Reconstruct the entry’s bytes. path is carried for error messages only.
With verify, each chunk’s bytes are blake3-checked against what the
index recorded for it (Design law 3).