Trait PollingPolicy

Source
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§

Source

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.

Provided Methods§

Source

fn on_in_progress( &self, _loop_start: Instant, _attempt_count: u32, _operation_name: &str, ) -> Option<Error>

Called when the LRO is successfully polled, but the LRO is still in progress.

Implementors§