Skip to main content

Module backoff

Module backoff 

Source
Expand description

Exponential backoff for use with QCS.

This re-exports types from backon and provides a default_backoff function to create a more useful default ExponentialBuilder.

ExponentialBuilder is cheaply Clone/Copy, so it can be stored and reused to BackoffBuilder::build a fresh [ExponentialBackoff] iterator for each retry sequence.

Structs§

BlockingRetry
Retry structure generated by BlockingRetryable.
BlockingRetryWithContext
Retry structure generated by BlockingRetryableWithContext.
ConstantBuilder
ConstantBuilder is used to create a [ConstantBackoff], providing a steady delay with a fixed number of retries.
ExponentialBuilder
ExponentialBuilder is used to construct an [ExponentialBackoff] that offers delays with exponential retries.
FibonacciBuilder
FibonacciBuilder is used to build a [FibonacciBackoff] which offers a delay with Fibonacci-based retries.
Retry
Struct generated by Retryable.
RetryWithContext
Retry struct generated by RetryableWithContext.
StdSleeper
The implementation of StdSleeper uses std::thread::sleep.
TokioSleeper
The default implementation of Sleeper uses tokio::time::sleep.

Traits§

Backoff
Backoff is an Iterator that returns Duration.
BackoffBuilder
BackoffBuilder is utilized to construct a new backoff.
BlockingRetryable
BlockingRetryable adds retry support for blocking functions.
BlockingRetryableWithContext
BlockingRetryableWithContext adds retry support for blocking functions.
BlockingSleeper
A sleeper is used sleep for a specified duration.
Retryable
Retryable will add retry support for functions that produce futures with results.
RetryableWithContext
RetryableWithContext adds retry support for functions that produce futures with results and context.
Sleeper
A sleeper is used to generate a future that completes after a specified duration.

Functions§

default_backoff
Create a default ExponentialBuilder for use with QCS.
duration_from_io_error
Return Some if the error is one that makes sense to retry and method is one that indicates it is safe to retry.
duration_from_reqwest_error
Return Some if the error is one that makes sense to retry and method is one that indicates it is safe to retry.
duration_from_response
Return Some if the response specifies a Retry-After header or the provided backoff has another backoff to try. If None is returned, the request should not be retried.
status_code_is_retry
Return true if the status code is one that could be retried.

Type Aliases§

DefaultBlockingSleeper
The default implementation of Sleeper while feature std-blocking-sleep enabled.
DefaultSleeper
The default implementation of Sleeper while feature tokio-sleep enabled.