pub struct RetryPolicy { /* private fields */ }Expand description
Bounded exponential-backoff policy with full jitter.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(
max_attempts: u32,
base_delay: Duration,
max_delay: Duration,
max_elapsed: Duration,
) -> Result<Self, S3Error>
pub fn new( max_attempts: u32, base_delay: Duration, max_delay: Duration, max_elapsed: Duration, ) -> Result<Self, S3Error>
Creates and validates a retry policy.
Sourcepub fn max_attempts(&self) -> u32
pub fn max_attempts(&self) -> u32
Returns the total number of allowed attempts, including the initial attempt.
Sourcepub fn base_delay(&self) -> Duration
pub fn base_delay(&self) -> Duration
Returns the initial backoff delay.
Sourcepub fn max_elapsed(&self) -> Duration
pub fn max_elapsed(&self) -> Duration
Returns the maximum elapsed time in which another attempt may begin.
Sourcepub fn permits_retry(
&self,
classification: RetryClassification,
attempts_completed: u32,
elapsed: Duration,
) -> bool
pub fn permits_retry( &self, classification: RetryClassification, attempts_completed: u32, elapsed: Duration, ) -> bool
Returns whether another attempt is allowed by classification and bounds.
Sourcepub fn delay(
&self,
attempts_completed: u32,
elapsed: Duration,
retry_after: Option<Duration>,
) -> Option<Duration>
pub fn delay( &self, attempts_completed: u32, elapsed: Duration, retry_after: Option<Duration>, ) -> Option<Duration>
Computes a full-jitter delay after attempts_completed attempts.
A server-provided Retry-After value is honored exactly when it fits
within the remaining elapsed-time bound.
Sourcepub fn delay_for(
&self,
classification: RetryClassification,
attempts_completed: u32,
elapsed: Duration,
retry_after: Option<Duration>,
) -> Option<Duration>
pub fn delay_for( &self, classification: RetryClassification, attempts_completed: u32, elapsed: Duration, retry_after: Option<Duration>, ) -> Option<Duration>
Computes a classification-aware full-jitter delay.
Standard AWS retry behavior uses a one-second backoff base for throttling and a shorter base for other transient failures.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
impl Eq for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.