pub trait PollingPolicy:
Send
+ Sync
+ Debug {
// Required method
fn on_error(
&self,
loop_start: Instant,
attempt_count: u32,
error: Error,
) -> LoopState;
// Provided method
fn on_in_progress(
&self,
_loop_start: Instant,
_attempt_count: u32,
_operation_name: &str,
) -> Option<Error> { ... }
}Expand description
Determines how errors are handled in the polling loop.
Implementations of this trait determine if polling errors may resolve in future attempts, and for how long the polling loop may continue.
Required Methods§
Sourcefn on_error(
&self,
loop_start: Instant,
attempt_count: u32,
error: Error,
) -> LoopState
fn on_error( &self, loop_start: Instant, attempt_count: u32, error: Error, ) -> LoopState
Query the polling policy after an error.
§Parameters
loop_start- when the polling loop started.attempt_count- the number of attempts. This includes the initial attempt. This method called after LRO successfully starts, it is always non-zero.error- the last error when attempting the request.