Skip to main content

Sender

Struct Sender 

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

One peer’s absolute send reservations and bounded sent-but-unreceipted ledger.

No payload ownership or quorum state lives here. Keep one instance per peer; a slow peer cannot consume another peer’s local capacity. Updates allocate no memory.

Implementations§

Source§

impl Sender

Source

pub fn open( report: Report, limits: PipelineLimits, verified_received: Prefix, ) -> Result<Self, FlowError>

Open after a fresh correlated exchange with the bound peer and epoch.

verified_received must come from exact local-history lookup, not a copied untrusted report field. This comparison grants no election or commit authority. Opening never implicitly replaces another instance; the adapter must fence its old packets and status correlation before adopting a new epoch. limits bounds local sent-but-unreceipted metadata/body ownership, not the remote receive window. A larger remote window never enlarges it.

Source

pub fn reopen( &mut self, report: Report, verified_received: Prefix, ) -> Result<(), FlowError>

Replace an explicitly retired channel after a fresh, history-verified open.

Preserves startup metadata capacity instead of allocating another ledger. The adapter must fence old payload ownership, validate probe/session/scope correlation, and independently verify both reported base and receipt history. verified_received has the same requirements as in open. Same-channel status belongs in observe; it must never reset send charges.

Source

pub const fn report(&self) -> Report

Latest verified receiver accounting, including the channel’s fixed base.

Source

pub const fn channel(&self) -> Channel

Exact channel to attach to payloads and check on incoming reports.

Source

pub const fn sent(&self) -> Prefix

Highest PEER reservation or independently verified PUB receipt. Not evidence of transport submission, persistence, or a quorum.

Source

pub const fn received(&self) -> Prefix

Latest verified volatile receipt. Never use as a durable quorum ACK.

Source

pub fn available(&self) -> PipelineLimits

Remaining local outstanding capacity. May be zero; not a reservation. Reports cannot grow the local ledger.

Source

pub fn outstanding(&self) -> impl ExactSizeIterator<Item = &Operation>

Bounded outstanding metadata, in canonical order, for probe/repair planning. Retransmission reuses these existing reservations rather than calling record_send.

Source

pub fn record_send( &mut self, channel: Channel, operations: &[Operation], ) -> Result<(), FlowError>

Charge local metadata once for a new contiguous suffix in the send path.

Reserve local payload/outbox capacity first. After success the adapter must retain the transmission across local backpressure or fence the whole epoch. Do not call again for a retry, duplicate, or packet still queued locally.

Source

pub fn observe(&mut self, report: Report) -> Result<bool, FlowError>

Incorporate same-epoch receipt progress. Return false for stale or exact repeats.

Check the exact receipt boundary and cumulative bytes against reserved sends before freeing metadata. Conflicting same-revision reports and all retractions fail without changing state. Epoch changes require a separate correlated open.

Trait Implementations§

Source§

impl Debug for Sender

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, 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 = !

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.