Trait hedwig::googlepubsub::retry_policy::RetryPolicy[][src]

pub trait RetryPolicy<T, E> where
    T: ?Sized
{ type RetryOp: RetryOperation<T, E>; fn new_operation(&mut self) -> Self::RetryOp; }
This is supported on crate feature google only.
Expand description

A policy to determine how operations should be retried after failure.

Policy implementations, along with their associated RetryOperation instances, can inform callers on when to perform retries. Notably these retries are external from these types, akin to external vs internal iteration. That is, the caller is responsible for actually re-attempting their operation, and the policy only guides the caller on how to do so. This can allow more flexible control flow in the retry path, at the expense of pushing more responsibility and complexity on the user compared to internal retry mechanisms.

Associated Types

Required methods

Prepare to retry some operation.

This can be called before or after the intial operation is executed, in preparation to begin retries. After the initial operation fails, the returned RetryOperation can be used to check whether that failure is retriable.

See RetryOperation::check_retry for more details.

Implementors