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§
- Blocking
Retry - Retry structure generated by
BlockingRetryable. - Blocking
Retry With Context - Retry structure generated by
BlockingRetryableWithContext. - Constant
Builder - ConstantBuilder is used to create a [
ConstantBackoff], providing a steady delay with a fixed number of retries. - Exponential
Builder - ExponentialBuilder is used to construct an [
ExponentialBackoff] that offers delays with exponential retries. - Fibonacci
Builder - FibonacciBuilder is used to build a [
FibonacciBackoff] which offers a delay with Fibonacci-based retries. - Retry
- Struct generated by
Retryable. - Retry
With Context - Retry struct generated by
RetryableWithContext. - StdSleeper
- The implementation of
StdSleeperusesstd::thread::sleep. - Tokio
Sleeper - The default implementation of
Sleeperusestokio::time::sleep.
Traits§
- Backoff
- Backoff is an
Iteratorthat returnsDuration. - Backoff
Builder - BackoffBuilder is utilized to construct a new backoff.
- Blocking
Retryable - BlockingRetryable adds retry support for blocking functions.
- Blocking
Retryable With Context - BlockingRetryableWithContext adds retry support for blocking functions.
- Blocking
Sleeper - A sleeper is used sleep for a specified duration.
- Retryable
- Retryable will add retry support for functions that produce futures with results.
- Retryable
With Context RetryableWithContextadds 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
ExponentialBuilderfor use with QCS. - duration_
from_ io_ error - Return
Someif the error is one that makes sense to retry andmethodis one that indicates it is safe to retry. - duration_
from_ reqwest_ error - Return
Someif the error is one that makes sense to retry andmethodis one that indicates it is safe to retry. - duration_
from_ response - Return
Someif the response specifies aRetry-Afterheader or the providedbackoffhas another backoff to try. IfNoneis returned, the request should not be retried. - status_
code_ is_ retry - Return
trueif the status code is one that could be retried.
Type Aliases§
- Default
Blocking Sleeper - The default implementation of
Sleeperwhile featurestd-blocking-sleepenabled. - Default
Sleeper - The default implementation of
Sleeperwhile featuretokio-sleepenabled.