pub struct RetryHandler { /* private fields */ }Expand description
Retry handler with exponential backoff.
Implementations§
Source§impl RetryHandler
impl RetryHandler
Sourcepub fn new(config: &RetryConfig) -> Self
pub fn new(config: &RetryConfig) -> Self
Create a new retry handler from configuration.
Sourcepub fn default_handler() -> Self
pub fn default_handler() -> Self
Create with default configuration.
Sourcepub async fn execute<F, Fut, T>(&self, operation: F) -> PhyTraceResult<T>
pub async fn execute<F, Fut, T>(&self, operation: F) -> PhyTraceResult<T>
Execute an async operation with retries.
Sourcepub async fn execute_with_stats<F, Fut, T>(
&self,
operation: F,
) -> (PhyTraceResult<T>, RetryStats)
pub async fn execute_with_stats<F, Fut, T>( &self, operation: F, ) -> (PhyTraceResult<T>, RetryStats)
Execute with retries and return attempt count.
Sourcepub fn should_retry(&self, result: &SendResult) -> bool
pub fn should_retry(&self, result: &SendResult) -> bool
Check if a send result indicates a retryable failure.
Sourcepub fn calculate_delay(&self, attempt: u32) -> Duration
pub fn calculate_delay(&self, attempt: u32) -> Duration
Calculate delay for a given attempt number.
Sourcepub fn max_retries(&self) -> u32
pub fn max_retries(&self) -> u32
Get the maximum number of retries.
Sourcepub fn initial_backoff(&self) -> Duration
pub fn initial_backoff(&self) -> Duration
Get the initial backoff duration.
Trait Implementations§
Source§impl Clone for RetryHandler
impl Clone for RetryHandler
Source§fn clone(&self) -> RetryHandler
fn clone(&self) -> RetryHandler
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 moreAuto Trait Implementations§
impl Freeze for RetryHandler
impl RefUnwindSafe for RetryHandler
impl Send for RetryHandler
impl Sync for RetryHandler
impl Unpin for RetryHandler
impl UnwindSafe for RetryHandler
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