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
impl ProbeScheduler
Sourcepub fn new(
first: RequestId,
timing: ProbeTiming,
now: Duration,
) -> Result<Self, ProbeError>
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.
Sourcepub const fn due(&self) -> Duration
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.
Sourcepub fn pace_new_work(&mut self)
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.
Sourcepub const fn pending(&self) -> Option<Probe>
pub const fn pending(&self) -> Option<Probe>
Currently outstanding frozen request, for exact response/history-work matching.
Sourcepub fn poll(
&mut self,
scope: Scope,
tail: Prefix,
available: OpNumber,
now: Duration,
) -> Result<Option<Probe>, ProbeError>
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.
Sourcepub fn complete(
&mut self,
scope: Scope,
id: RequestId,
now: Duration,
) -> Result<bool, ProbeError>
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.
Sourcepub fn invalidate(&mut self, now: Duration) -> Result<(), ProbeError>
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.