Struct ReceiverBaselines

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

Receiver-only installed bytes. Applying into scratch never installs or ACKs the result; the caller must decode, validate and accept it first.

Implementations§

Source§

impl ReceiverBaselines

Source

pub fn new(limits: BaselineLimits) -> Result<ReceiverBaselines, BaselineError>

Fallibly preallocate count and byte budgets; see the module recipe.

Source

pub fn install( &mut self, tick: u32, bytes: &[u8], ) -> Result<RetainOutcome, BaselineError>

Retain bytes after application validation/acceptance, before issuing the snapshot ACK. On failure, do not ACK or publish the snapshot. This method does not parse bytes or check external session/membership/tick fields.

Source

pub fn apply_into( &self, delta: &Delta, destination: &mut [u8], ) -> Result<usize, ApplyError>

Apply against the exact installed base tick into caller scratch. Reject nonadvancing result ticks, missing baselines and invalid deltas before writes. Success preserves the output tail and installed history. Missing or invalid baselines need caller-controlled full recovery; preserve request rate limits. Nonadvancing packets can simply be ignored. The codec cannot detect same-length baseline content from another session: external session authentication and immutable exact-byte installation are required.

Source

pub fn get(&self, tick: u32) -> Option<&[u8]>

Exact installed bytes available for reconstruction.

Source

pub fn len(&self) -> usize

Current snapshot count, including empty snapshots.

Source

pub fn is_empty(&self) -> bool

Whether there are no installed snapshots.

Source

pub fn retained_bytes(&self) -> usize

Sum of retained installed byte lengths.

Source

pub fn latest_tick(&self) -> Option<u32>

Latest installed tick, distinct from a merely applied scratch result.

Source

pub fn reset(&mut self)

Clear installed bytes, ticks and generations, keeping allocations. External session checks remain mandatory after reset.

Trait Implementations§

Source§

impl Debug for ReceiverBaselines

Source§

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

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