Skip to main content

RegionDeltaSplitter

Struct RegionDeltaSplitter 

Source
pub struct RegionDeltaSplitter {
    pub chunk_size: usize,
}
Expand description

The splitter the per-entry seam could not have: one file, part chunk and part delta.

Both the base and the target are tiled at chunk_size. For each tile:

  • bytes identical to the base’s tile at the same offset → a delta unit, which for an unchanged region is a single COPY instruction of a few bytes whatever the tile’s size;
  • anything else → an ordinary byte unit.

So a large file with one edited region stores the edited region in full and everything else as ~6 bytes per tile, and EntryReader had no way to say that: its choice was per entry, so the whole file went one way or the other.

§What it costs, said plainly

Every delta unit names the same base, and reconstruction resolves that base once — see the memo in Entry::reconstruct. Without that memo this shape would be quadratic in the number of unchanged tiles, which is the one new cost moving the seam introduces and the reason the memo is not optional.

A tile that differs is stored whole rather than delta’d against its counterpart. That is the conservative choice: a per-tile delta would need its own base-size bookkeeping for no saving on the case this exists for.

Fields§

§chunk_size: usize

Trait Implementations§

Source§

impl Splitter for RegionDeltaSplitter

Source§

fn split( &self, path: &str, bytes: &[u8], previous: Option<(&str, &[u8], usize)>, compressed_len: &mut dyn FnMut(&[u8]) -> usize, ) -> Vec<StoredUnit>

Cut bytes into the units to store for path. Read more

Auto Trait Implementations§

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.