pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_delay_ms: u64,
pub max_delay_ms: u64,
pub backoff_multiplier: f64,
pub jitter_factor: f64,
}Expand description
Exponential back-off retry configuration.
Fields§
§max_attempts: u32Maximum number of total attempts (first attempt + retries).
initial_delay_ms: u64Delay before the first retry, in milliseconds.
max_delay_ms: u64Upper bound on the computed delay, in milliseconds.
backoff_multiplier: f64Multiplicative factor applied to the delay after each attempt.
jitter_factor: f64Fraction of the computed delay to use as random jitter in [0, 1].
0.0 = no jitter, 1.0 = full ±100 % jitter.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new() -> Self
pub fn new() -> Self
Default policy: 3 attempts, 100 ms initial, 30 s cap, ×2 back-off, 10 % jitter.
Sourcepub fn aggressive() -> Self
pub fn aggressive() -> Self
Aggressive policy: 5 attempts, 50 ms initial, 60 s cap, ×2 back-off, 10 % jitter.
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Compute the delay before attempt attempt (0-indexed).
Formula: min(initial * multiplier^attempt, max) * (1 ± jitter)
Jitter is deterministic: it is derived from the attempt number using an LCG so that tests are reproducible without a PRNG dependency.
Sourcepub fn is_retryable(error: &CloudError) -> bool
pub fn is_retryable(error: &CloudError) -> bool
Returns true if the error is considered transient and worth retrying.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more