Struct opendal::layers::RetryLayer
source · Expand description
RetryLayer will add retry for OpenDAL.
Examples
use anyhow::Result;
use backon::ExponentialBackoff;
use opendal::layers::RetryLayer;
use opendal::Operator;
use opendal::Scheme;
let _ = Operator::from_env(Scheme::Fs)
.expect("must init")
.layer(RetryLayer::new(ExponentialBackoff::default()));
Implementations§
source§impl<B> RetryLayer<B>where
B: Backoff + Send + Sync + Debug + 'static,
impl<B> RetryLayer<B>where
B: Backoff + Send + Sync + Debug + '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::Operator;
use opendal::Scheme;
let _ = Operator::from_env(Scheme::Fs)
.expect("must init")
.layer(RetryLayer::new(ExponentialBackoff::default()));