Struct opendal::layers::RetryLayer

source ·
pub struct RetryLayer(_);
Expand description

Add retry for temporary failed operations.

Notes

This layer will retry failed operations when Error::is_temporary returns true. If operation still failed, this layer will set error to Persistent which means error has been retried.

write and blocking_write don’t support retry so far, visit this issue for more details.

Examples

use anyhow::Result;
use opendal::layers::RetryLayer;
use opendal::services;
use opendal::Operator;
use opendal::Scheme;

let _ = Operator::new(services::Memory::default())
    .expect("must init")
    .layer(RetryLayer::new())
    .finish();

Implementations§

Create a new retry layer.

Examples
use anyhow::Result;
use opendal::layers::RetryLayer;
use opendal::services;
use opendal::Operator;
use opendal::Scheme;

let _ = Operator::new(services::Memory::default())
    .expect("must init")
    .layer(RetryLayer::new());

Set jitter of current backoff.

If jitter is enabled, ExponentialBackoff will add a random jitter in `[0, min_delay) to current delay.

Set factor of current backoff.

Panics

This function will panic if input factor smaller than 1.0.

Set min_delay of current backoff.

Set max_delay of current backoff.

Delay will not increasing if current delay is larger than max_delay.

Set max_times of current backoff.

Backoff will return None if max times is reaching.

Trait Implementations§

Returns the “default value” for a type. Read more
The layered accessor that return by this layer.
Intercept the operations on the underlying storage.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Applies the [Compat] adapter by value. Read more
Applies the [Compat] adapter by shared reference. Read more
Applies the [Compat] adapter by mutable reference. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more