pub struct RealClock;Expand description
The production Clock: real wall time and a real timer.
Clock::now reads the system clock and Clock::sleep awaits a tokio
timer, so the retry path spreads and waits exactly as it did before the seam
was introduced.
Trait Implementations§
Source§impl Clock for RealClock
impl Clock for RealClock
Source§fn now(&self) -> SystemTime
fn now(&self) -> SystemTime
The current wall-clock time.
Source§fn sleep<'life0, 'async_trait>(
&'life0 self,
dur: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sleep<'life0, 'async_trait>(
&'life0 self,
dur: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Wait for
dur before the caller retries. Read moreSource§fn jitter_frac(&self) -> f64
fn jitter_frac(&self) -> f64
A jitter fraction in
[0, 1) used to spread retries (equal jitter in
backoff_delay). The exact value only matters for the spread, so the
default derives it from Self::now — the same cheap clock read the
retry path used before the seam existed. A deterministic clock overrides
this with a seeded draw so a replay reproduces the same spacing.impl Copy for RealClock
Auto Trait Implementations§
impl Freeze for RealClock
impl RefUnwindSafe for RealClock
impl Send for RealClock
impl Sync for RealClock
impl Unpin for RealClock
impl UnsafeUnpin for RealClock
impl UnwindSafe for RealClock
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more