Trait opendal::layers::RetryInterceptor
source · pub trait RetryInterceptor: Send + Sync + 'static {
// Required method
fn intercept(&self, err: &Error, dur: Duration, ctx: &[(&str, &str)]);
}
Expand description
RetryInterceptor is used to intercept while retry happened.
Required Methods§
sourcefn intercept(&self, err: &Error, dur: Duration, ctx: &[(&str, &str)])
fn intercept(&self, err: &Error, dur: Duration, ctx: &[(&str, &str)])
Everytime RetryLayer is retrying, this function will be called.
§Timing
just before the retry sleep.
§Inputs
- err: The error that caused the current retry.
- dur: The duration that will sleep before next retry.
- ctx: The context (
name
,value
) of current operation, likeoperation
andpath
.
§Notes
The intercept must be quick and non-blocking. No heavy IO is allowed. Otherwise the retry will be blocked.