pub struct RetryPace { /* private fields */ }Expand description
Pacing for a recovery loop that never gives up.
Construct once, wait() before each attempt. There is no next() that
grows, no attempt counter, and no terminal state — that absence is the
contract.
Implementations§
Source§impl RetryPace
impl RetryPace
Sourcepub const fn fixed(base: Duration) -> Self
pub const fn fixed(base: Duration) -> Self
A fixed interval with no jitter.
Correct only where nothing else on the estate is looping against the
same resource on the same cadence. If two independent loops can
rendezvous, use RetryPace::jittered.
Sourcepub const fn jittered(base: Duration, jitter: Duration) -> Self
pub const fn jittered(base: Duration, jitter: Duration) -> Self
A fixed interval plus a uniform random 0..=jitter.
The jitter breaks phase-lock between two loops that have no shared clock, which is what the WFB bind rendezvous needs.
Sourcepub fn wait(&self) -> Duration
pub fn wait(&self) -> Duration
The wait before the next attempt.
Deliberately takes no attempt index: an interval that could vary by
attempt is an interval that can grow, and the whole point is that this
one cannot. Compute the jitter from rand in 0..=jitter; a failure to
read the OS entropy source degrades to zero jitter rather than
propagating, because a loop that stops pacing is worse than a loop that
briefly loses its phase-lock protection.
Trait Implementations§
impl Copy for RetryPace
impl Eq for RetryPace
impl StructuralPartialEq for RetryPace
Auto Trait Implementations§
impl Freeze for RetryPace
impl RefUnwindSafe for RetryPace
impl Send for RetryPace
impl Sync for RetryPace
impl Unpin for RetryPace
impl UnsafeUnpin for RetryPace
impl UnwindSafe for RetryPace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.