pub struct ReconnectConfig {
pub initial_backoff_ms: u64,
pub max_backoff_ms: u64,
pub backoff_factor: f64,
pub max_retries: u32,
pub jitter_fraction: f64,
}Expand description
Configuration for replica reconnection backoff.
Fields§
§initial_backoff_ms: u64Initial backoff duration in milliseconds (default: 100).
max_backoff_ms: u64Maximum backoff duration in milliseconds (default: 30_000).
backoff_factor: f64Multiplicative backoff factor (default: 2.0).
max_retries: u32Maximum number of retry attempts. 0 means unlimited (default: 0).
jitter_fraction: f64Fraction of the current backoff to use as jitter range (default: 0.25).
The actual sleep is backoff +/- (backoff * jitter_fraction / 2).
Implementations§
Source§impl ReconnectConfig
impl ReconnectConfig
Sourcepub fn next_backoff(&self, attempt: u32) -> Duration
pub fn next_backoff(&self, attempt: u32) -> Duration
Calculate the backoff duration for the given attempt number (0-indexed).
Applies exponential growth capped at max_backoff_ms, then adds
symmetric jitter within +/- jitter_fraction/2 of the base value.
Trait Implementations§
Source§impl Clone for ReconnectConfig
impl Clone for ReconnectConfig
Source§fn clone(&self) -> ReconnectConfig
fn clone(&self) -> ReconnectConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReconnectConfig
impl Debug for ReconnectConfig
Auto Trait Implementations§
impl Freeze for ReconnectConfig
impl RefUnwindSafe for ReconnectConfig
impl Send for ReconnectConfig
impl Sync for ReconnectConfig
impl Unpin for ReconnectConfig
impl UnsafeUnpin for ReconnectConfig
impl UnwindSafe for ReconnectConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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