pub trait ClassifyRetry:
Send
+ Sync
+ Debug {
// Required methods
fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction;
fn name(&self) -> &'static str;
// Provided methods
fn classify_retry_v2(
&self,
ctx: &InterceptorContext,
previous: &RetryAction,
) -> RetryAction { ... }
fn priority(&self) -> RetryClassifierPriority { ... }
}Expand description
Classifies what kind of retry is needed for a given InterceptorContext.
Required Methods§
Sourcefn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction
fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction
Run this classifier on the InterceptorContext to determine if the previous request
should be retried. Returns a RetryAction.
Prefer implementing classify_retry_v2 when a
classifier needs the RetryAction accumulated by earlier-running classifiers (e.g. to
refine an already-retryable verdict). This method has no access to that cumulative verdict;
it remains the required building block that classify_retry_v2 delegates to by default.
Provided Methods§
Sourcefn classify_retry_v2(
&self,
ctx: &InterceptorContext,
previous: &RetryAction,
) -> RetryAction
fn classify_retry_v2( &self, ctx: &InterceptorContext, previous: &RetryAction, ) -> RetryAction
Run this classifier with awareness of the RetryAction accumulated by
earlier-running (lower-priority) classifiers. previous is the running
result of classification so far (RetryAction::NoActionIndicated until
some classifier sets one).
The default implementation ignores previous and delegates to
classify_retry, so existing classifiers
are unaffected. Override this to refine a verdict produced by an
earlier-running classifier — for example, to attach a server-directed
delay to an already-retryable response.
Sourcefn priority(&self) -> RetryClassifierPriority
fn priority(&self) -> RetryClassifierPriority
The priority of this retry classifier.
Classifiers with a higher priority will override the results of classifiers with a lower priority. Classifiers with equal priorities make no guarantees about which will override the other.
Retry classifiers are run in order of increasing priority. Any decision
(return value other than NoActionIndicated) from a higher priority
classifier will override the decision of a lower priority classifier with one exception:
RetryAction::RetryForbidden is treated differently: If ANY classifier returns RetryForbidden,
this request will not be retried.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".