pub struct RetryConfig {
pub max_retries: u32,
pub initial_delay_ms: u64,
pub max_delay_ms: u64,
pub exponential_base: f64,
pub jitter: bool,
pub jitter_factor: f64,
pub retryable_status_codes: HashSet<u16>,
}Expand description
Configuration for retry behavior.
Fields§
§max_retries: u32Maximum number of retry attempts (0 = no retries).
initial_delay_ms: u64Initial delay before the first retry (in milliseconds).
max_delay_ms: u64Maximum delay between retries (in milliseconds).
exponential_base: f64Base for exponential backoff (typically 2.0).
jitter: boolWhether to add random jitter to delays.
jitter_factor: f64Jitter factor (0.0 to 1.0) - how much randomness to add.
retryable_status_codes: HashSet<u16>HTTP status codes that should trigger a retry.
Uses HashSet for O(1) lookups instead of O(n) linear search.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn builder() -> RetryConfigBuilder
pub fn builder() -> RetryConfigBuilder
Creates a new builder for RetryConfig.
Sourcepub fn aggressive() -> Self
pub fn aggressive() -> Self
Creates a config optimized for aggressive retrying.
Sourcepub fn conservative() -> Self
pub fn conservative() -> Self
Creates a config optimized for conservative retrying.
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Calculates the delay for a given attempt number.
Sourcepub fn is_retryable_status(&self, status_code: u16) -> bool
pub fn is_retryable_status(&self, status_code: u16) -> bool
Checks if a status code should trigger a retry.
Sourcepub fn is_retryable_error(&self, error: &AptosError) -> bool
pub fn is_retryable_error(&self, error: &AptosError) -> bool
Checks if an error should trigger a retry.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 RetryConfig
impl Debug for RetryConfig
Auto Trait Implementations§
impl Freeze for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnwindSafe for RetryConfig
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