Struct condow_rusoto::config::RetryConfig
source · [−]#[non_exhaustive]pub struct RetryConfig {
pub max_attempts: RetryMaxAttempts,
pub initial_delay_ms: RetryInitialDelayMs,
pub delay_factor: RetryDelayFactor,
pub max_delay_ms: RetryDelayMaxMs,
pub max_stream_resume_attempts: RetryMaxStreamResumeAttempts,
}
Expand description
Configures retries with exponential backoff
Overview
Retries can be done on the downloads themselves as well on the byte streams returned from a client. If an error occurs while streaming bytes ConDow will try to reconnect with retries and continue streaming where the previous stream failed. Streaming will always be aborted if no bytes were read 3 times in a row even though successful requests for a stream were made.
Retries can also be attempted on size requests.
Be aware that some clients might also do retries themselves based on their underlying implementation. In this case you should disable retries for either the client or ConDow itself.
Limitations
ConDow can only try to resume on byte stream errors if the underlying CondowClient returns an exact bound on the number of bytes returned when a new stream is created.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.max_attempts: RetryMaxAttempts
The maximum number of retry attempts.
initial_delay_ms: RetryInitialDelayMs
The delay before the first retry attempt.
delay_factor: RetryDelayFactor
A factor to multiply a current delay with to get the next one
max_delay_ms: RetryDelayMaxMs
The maximum delay for a retry.
max_stream_resume_attempts: RetryMaxStreamResumeAttempts
The maximum number of attempts to resume a byte stream from the same offset.
Setting this to 0 will disable resumes. Enabling them has a small overhead since the current progress on a byte stream must be tracked.
Implementations
sourceimpl RetryConfig
impl RetryConfig
sourcepub fn from_env() -> Result<Option<RetryConfig>, Error>
pub fn from_env() -> Result<Option<RetryConfig>, Error>
Tries to initialize all fields from environment variables prefixed with “CONDOW_”
If no env variables were found None
is returned.
Otherwise thise found will be set and the rest will be initialized with their defaults.
sourcepub fn from_env_type_names() -> Result<Option<RetryConfig>, Error>
pub fn from_env_type_names() -> Result<Option<RetryConfig>, Error>
Tries to initialize all fields from environment variables without any prefix
If no env variables were found None
is returned.
Otherwise thise found will be set and the rest will be initialized with their defaults.
sourcepub fn from_env_prefixed<T>(prefix: T) -> Result<Option<RetryConfig>, Error> where
T: AsRef<str>,
pub fn from_env_prefixed<T>(prefix: T) -> Result<Option<RetryConfig>, Error> where
T: AsRef<str>,
Tries to initialize all fields from environment variables prefixed with “[prefix]_”
The underscore is omitted if prefix
is empty
If no env variables were found None
is returned.
Otherwise thise found will be set and the rest will be initialized with their defaults.
sourcepub fn max_attempts<T>(self, max_attempts: T) -> RetryConfig where
T: Into<RetryMaxAttempts>,
pub fn max_attempts<T>(self, max_attempts: T) -> RetryConfig where
T: Into<RetryMaxAttempts>,
Set the maximum number of attempts for retries
sourcepub fn initial_delay_ms<T>(self, initial_delay_ms: T) -> RetryConfig where
T: Into<RetryInitialDelayMs>,
pub fn initial_delay_ms<T>(self, initial_delay_ms: T) -> RetryConfig where
T: Into<RetryInitialDelayMs>,
Set the delay for the first retry attempt after the original operation failed
sourcepub fn delay_factor<T>(self, delay_factor: T) -> RetryConfig where
T: Into<RetryDelayFactor>,
pub fn delay_factor<T>(self, delay_factor: T) -> RetryConfig where
T: Into<RetryDelayFactor>,
Set the factor by which each current delay will be multiplied by to get the next delay
This is actually what makes it exponentially when greater than 1.0.
sourcepub fn max_delay_ms<T>(self, max_delay_ms: T) -> RetryConfig where
T: Into<RetryDelayMaxMs>,
pub fn max_delay_ms<T>(self, max_delay_ms: T) -> RetryConfig where
T: Into<RetryDelayMaxMs>,
Set the maximum duration in milliseconds for a single delay
sourcepub fn max_stream_resume_attempts<T>(
self,
max_stream_resume_attempts: T
) -> RetryConfig where
T: Into<RetryMaxStreamResumeAttempts>,
pub fn max_stream_resume_attempts<T>(
self,
max_stream_resume_attempts: T
) -> RetryConfig where
T: Into<RetryMaxStreamResumeAttempts>,
The maximum number of attempts to resume a byte stream from the same offset.
Setting this to 0 will disable resumes. Enabling them has a small overhead since the current progress on a byte stream must be tracked.
sourcepub fn no_stream_resume_attempts(self) -> RetryConfig
pub fn no_stream_resume_attempts(self) -> RetryConfig
Disable attempts to resume a byte stream from the same offset.
sourcepub fn validated(self) -> Result<RetryConfig, Error>
pub fn validated(self) -> Result<RetryConfig, Error>
Validate this RetryConfig and return it if it is valid.
Can be used as a finalizer after builder style construction.
See also RetryConfig::validate
Trait Implementations
sourceimpl Clone for RetryConfig
impl Clone for RetryConfig
sourcefn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RetryConfig
impl Debug for RetryConfig
sourceimpl Default for RetryConfig
impl Default for RetryConfig
sourcefn default() -> RetryConfig
fn default() -> RetryConfig
Returns the “default value” for a type. Read more
sourceimpl PartialEq<RetryConfig> for RetryConfig
impl PartialEq<RetryConfig> for RetryConfig
sourcefn eq(&self, other: &RetryConfig) -> bool
fn eq(&self, other: &RetryConfig) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RetryConfig) -> bool
fn ne(&self, other: &RetryConfig) -> bool
This method tests for !=
.
impl StructuralPartialEq for RetryConfig
Auto Trait Implementations
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnwindSafe for RetryConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more