Skip to main content

ProbeScheduler

Struct ProbeScheduler 

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

Allocation-free, one-outstanding-request scheduler for one authenticated peer.

Poll only when the adapter needs receipt status. Opening is immediate; unanswered small requests back off to an explicit ceiling. Repeated calls at one instant emit at most one pending request. New work after a completed exchange opens immediately unless paced; unchanged status retains its pacing delay. A fresh valid response resets pacing. No observation changes durable ACKs, quorum state, or commit-progress deadlines.

Implementations§

Source§

impl ProbeScheduler

Source

pub fn new( first: RequestId, timing: ProbeTiming, now: Duration, ) -> Result<Self, ProbeError>

Start a peer-local request sequence and clock without allocating or reading time.

Supply a fresh process/session-specific starting ID, never a reused constant across actor lifetimes. Keep this scheduler across view/receive-epoch changes; invalidate retires correlation without resetting the identity sequence.

Source

pub const fn due(&self) -> Duration

When an unchanged exchange is next sent or retried. New work after a completed exchange opens one sooner unless paced.

Source

pub fn pace_new_work(&mut self)

Hold new work to the pacing delay too, for a receiver that reports receipt unasked. A probe then only has to find loss.

Source

pub const fn pending(&self) -> Option<Probe>

Currently outstanding frozen request, for exact response/history-work matching.

Source

pub fn poll( &mut self, scope: Scope, tail: Prefix, available: OpNumber, now: Duration, ) -> Result<Option<Probe>, ProbeError>

Emit a new small probe when due, or retry the exact pending request.

Changed tail or available does not mutate a live exchange. After completion new availability bypasses the idle delay unless paced, and the next request captures both. A returned request remains owned here even if transport admission fails; retry keeps its request identity.

Source

pub fn complete( &mut self, scope: Scope, id: RequestId, now: Duration, ) -> Result<bool, ProbeError>

Retire a validated response only if its scope and ID name the live request.

Call after authenticated decoding and required report/history checks, not on arbitrary network activity. Stale replies do not extend retry deadlines. This method does not decide whether a newly reported receive epoch is valid.

Source

pub fn invalidate(&mut self, now: Duration) -> Result<(), ProbeError>

Retire correlation after role/session replacement, keeping identities monotonic. The next poll can open immediately; old responses cannot complete that request.

Trait Implementations§

Source§

impl Debug for ProbeScheduler

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.