Skip to main content

WindowReader

Struct WindowReader 

Source
pub struct WindowReader { /* private fields */ }
Expand description

An I/O-free decoder retaining only the current window and current entry.

Binding. Done means every entry yielded across the whole run chain (the original run and every resume through its cursors) is an entry, in order, of the one pack whose bytes hash to the verified pack id: the trailer, and expected_pack_id when set. A cursor from pack A used on a source that yields different bytes for any not-yet-verified range fails with PackfileCorrupted, never Done. The reader does not re-read ranges it has already verified. Keeping the source immutable across resumes is the caller’s job (informative: WP-4.8 binds R2 range reads to the object’s etag). A source whose already-verified prefix changed after verification can still reach Done, but only with entries of the verified pack.

Implementations§

Source§

impl WindowReader

Source

pub fn new( pack_len: u64, window_size: u64, limits: DecodeLimits, expected_pack_id: Option<Hash>, ) -> Result<Self, PackError>

Start a pack with power-of-two windows between 64 KiB and 64 MiB.

§Errors

Short pack lengths give PackfileTooShort; invalid geometry gives PackfileCorrupted.

Source

pub fn resume( cursor: &WindowCursor, limits: DecodeLimits, ) -> Result<Self, PackError>

Restore an entry boundary. The first request contains the next entry.

§Errors

Inconsistent cursors give PackfileCorrupted.

Source

pub fn step(&mut self) -> Result<Step, PackError>

Advance to a request, an entry, or verified completion.

§Errors

Malformed packs, resource limits, and failed integrity checks use the errors documented at module level. A parsing error makes the reader inert.

Source

pub fn feed(&mut self, offset: u64, bytes: &[u8]) -> Result<(), PackError>

Supply exactly the outstanding range. Wrong ranges leave it pending.

§Errors

Wrong ranges give PackfileCorrupted; failed allocations give PackfileTooLarge.

Source

pub fn feed_owned( &mut self, offset: u64, bytes: Vec<u8>, ) -> Result<(), PackError>

Supply a range by transferring its buffer, avoiding two full-window copies.

§Errors

Wrong ranges give PackfileCorrupted; allocation failure gives PackfileTooLarge.

Source

pub fn last_frame(&self) -> Option<FrameInfo>

The frame of the entry the latest Step::Entry returned, or None before the first one. A resumed reader starts with None.

Source

pub fn checkpoint(&self) -> Option<WindowCursor>

A compact checkpoint only at an entry boundary, never within an entry.

Hashes the current window prefix lazily on this call. Returns None if the reader has released the bytes needed for that prefix, including while fetching a split trailer or awaiting a resumed window. Keep the previous cursor in that case. No bytes are needed when the boundary is exactly at a window start. Mid-entry states, including carried straddling entries, never produce a checkpoint.

Trait Implementations§

Source§

impl Debug for WindowReader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Threaded<T> for T

Source§

type Rest = ()

The outputs beyond the threaded value.
Source§

fn split(self) -> (T, ())

Splits into the threaded value and the extra outputs.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more