Struct opendal::layers::RetryLayer
source · pub struct RetryLayer<B: Backoff + Send + Sync + Debug + Unpin + 'static>(_);
Expand description
RetryLayer will add retry for OpenDAL.
Examples
use anyhow::Result;
use backon::ExponentialBackoff;
use opendal::layers::RetryLayer;
use opendal::services;
use opendal::Operator;
use opendal::Scheme;
let _ = Operator::from_env::<services::Fs>()
.expect("must init")
.layer(RetryLayer::new(ExponentialBackoff::default()))
.finish();
Implementations§
source§impl<B> RetryLayer<B>where
B: Backoff + Send + Sync + Debug + Unpin + 'static,
impl<B> RetryLayer<B>where
B: Backoff + Send + Sync + Debug + Unpin + 'static,
sourcepub fn new(b: B) -> Self
pub fn new(b: B) -> Self
Create a new retry layer.
Examples
use anyhow::Result;
use backon::ExponentialBackoff;
use opendal::layers::RetryLayer;
use opendal::services;
use opendal::Operator;
use opendal::Scheme;
let _ = Operator::from_env::<services::Fs>()
.expect("must init")
.layer(RetryLayer::new(ExponentialBackoff::default()));
Trait Implementations§
source§impl<A, B> Layer<A> for RetryLayer<B>where
A: Accessor,
B: Backoff + Send + Sync + Debug + Unpin + 'static,
impl<A, B> Layer<A> for RetryLayer<B>where
A: Accessor,
B: Backoff + Send + Sync + Debug + Unpin + 'static,
§type LayeredAccessor = RetryAccessor<A, B>
type LayeredAccessor = RetryAccessor<A, B>
The layered accessor that return by this layer.
source§fn layer(&self, inner: A) -> Self::LayeredAccessor
fn layer(&self, inner: A) -> Self::LayeredAccessor
Intercept the operations on the underlying storage.