pub struct RetryPolicy {
pub max_retries: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub backoff_multiplier: f64,
pub jitter: bool,
}Expand description
Retry policy for transient error handling.
Per ADR-009, the driver can automatically retry operations that fail with transient errors (deadlocks, Azure service busy, etc.).
Fields§
§max_retries: u32Maximum number of retry attempts (default: 3).
initial_backoff: DurationInitial backoff duration before first retry (default: 100ms).
max_backoff: DurationMaximum backoff duration between retries (default: 30s).
backoff_multiplier: f64Multiplier for exponential backoff (default: 2.0).
jitter: boolWhether to add random jitter to backoff times (default: true).
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn max_retries(self, max: u32) -> Self
pub fn max_retries(self, max: u32) -> Self
Set the maximum number of retry attempts.
Sourcepub fn initial_backoff(self, backoff: Duration) -> Self
pub fn initial_backoff(self, backoff: Duration) -> Self
Set the initial backoff duration.
Sourcepub fn max_backoff(self, backoff: Duration) -> Self
pub fn max_backoff(self, backoff: Duration) -> Self
Set the maximum backoff duration.
Sourcepub fn backoff_multiplier(self, multiplier: f64) -> Self
pub fn backoff_multiplier(self, multiplier: f64) -> Self
Set the backoff multiplier for exponential backoff.
Sourcepub fn backoff_for_attempt(&self, attempt: u32) -> Duration
pub fn backoff_for_attempt(&self, attempt: u32) -> Duration
Calculate the backoff duration for a given retry attempt.
Uses exponential backoff with optional jitter.
Sourcepub fn should_retry(&self, attempt: u32) -> bool
pub fn should_retry(&self, attempt: u32) -> bool
Check if more retries are allowed for the given attempt number.
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