pub struct ReconnectBackoff { /* private fields */ }Expand description
Validated reconnect backoff settings drawn from WorkerConfig.
Implementations§
Source§impl ReconnectBackoff
impl ReconnectBackoff
Sourcepub fn from_config(config: &WorkerConfig) -> Result<Self, WorkerError>
pub fn from_config(config: &WorkerConfig) -> Result<Self, WorkerError>
Builds reconnect backoff from worker config.
§Errors
Returns WorkerError::Registration if delays or attempt counts are zero.
Sourcepub fn delay_for_attempt(&self, completed_failures: usize) -> Duration
pub fn delay_for_attempt(&self, completed_failures: usize) -> Duration
Returns the bounded exponential delay after completed_failures failures.
The delay doubles per completed failure starting from the configured initial backoff and is capped at the configured maximum backoff.
Sourcepub const fn attempts(&self) -> usize
pub const fn attempts(&self) -> usize
Returns the configured maximum number of reconnect attempts.
Sourcepub const fn max_delay(&self) -> Duration
pub const fn max_delay(&self) -> Duration
Returns the configured maximum backoff delay cap.
The run loop also uses this as its session-health threshold: the cap is the policy’s own definition of the longest pause, so an established session that survives longer than it is demonstrably past the flapping regime and resets the cumulative drop budget when it eventually drops.
Trait Implementations§
Source§impl Clone for ReconnectBackoff
impl Clone for ReconnectBackoff
Source§fn clone(&self) -> ReconnectBackoff
fn clone(&self) -> ReconnectBackoff
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReconnectBackoff
impl Debug for ReconnectBackoff
impl Eq for ReconnectBackoff
Source§impl PartialEq for ReconnectBackoff
impl PartialEq for ReconnectBackoff
Source§fn eq(&self, other: &ReconnectBackoff) -> bool
fn eq(&self, other: &ReconnectBackoff) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ReconnectBackoff
Auto Trait Implementations§
impl Freeze for ReconnectBackoff
impl RefUnwindSafe for ReconnectBackoff
impl Send for ReconnectBackoff
impl Sync for ReconnectBackoff
impl Unpin for ReconnectBackoff
impl UnsafeUnpin for ReconnectBackoff
impl UnwindSafe for ReconnectBackoff
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.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request