Skip to main content

Entry

Struct Entry 

Source
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

Source

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.

Source

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).

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnsafeUnpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.