pub struct RetryPolicy {
pub attempts: u32,
pub base: Duration,
pub factor: u32,
pub cap: Duration,
pub max_window: Duration,
pub connect_timeout: Option<Duration>,
}Expand description
Caller-tunable retry knobs (PRD §5.8.7 FR-80, FR-81).
Use Default for the values PRD §5.8.7 specifies (attempts = 3, base = 250 ms, factor = 2, cap = 8 s, max_window = 30 s,
connect_timeout = None). The builder-style setters return Self
so a CLI dispatcher can chain overrides.
Fields§
§attempts: u32Total number of attempts (initial + retries). Must be ≥ 1.
1 disables retry entirely; default 3.
base: DurationBase delay before the first retry. Default 250 ms.
factor: u32Multiplier on each successive retry. Default 2.
cap: DurationCap on a single backoff interval (excluding jitter). Default 8 s.
max_window: DurationHard ceiling on total elapsed wall-clock time across all attempts. Default 30 s. When the cap is reached the loop returns the most-recent error rather than starting another attempt.
connect_timeout: Option<Duration>Per-attempt TCP connect timeout. None = no timeout
(matches OpenSSH’s “no ConnectTimeout” semantics).
Default None.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn attempts(self, n: u32) -> Self
pub fn attempts(self, n: u32) -> Self
Builder setter for Self::attempts.
Sourcepub fn base(self, d: Duration) -> Self
pub fn base(self, d: Duration) -> Self
Builder setter for Self::base.
Sourcepub fn factor(self, f: u32) -> Self
pub fn factor(self, f: u32) -> Self
Builder setter for Self::factor.
Sourcepub fn max_window(self, d: Duration) -> Self
pub fn max_window(self, d: Duration) -> Self
Builder setter for Self::max_window.
Sourcepub fn connect_timeout(self, d: Option<Duration>) -> Self
pub fn connect_timeout(self, d: Option<Duration>) -> Self
Builder setter for Self::connect_timeout.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
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 RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
Source§fn eq(&self, other: &RetryPolicy) -> bool
fn eq(&self, other: &RetryPolicy) -> bool
self and other values to be equal, and is used by ==.