[][src]Crate kwait

Structs

Backoff

Backoff holds parameters applied to a Backoff function.

ExponentialBackoffManager
Group

Group allows to start a group of threads and wait for their completion.

JitteredBackoffManager

Traits

BackoffManager

BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides an interface to return a timer for backoff, and caller shall backoff until Timer.C() drains. If the second backoff() is called before the timer from the first backoff() call finishes, the first timer will NOT be drained and result in undetermined behavior. The BackoffManager is supposed to be called in a single-threaded environment.

Functions

backoff_until

backoff_until loops until stop channel is closed, run f every duration given by BackoffManager.

exponential_backoff

exponential_backoff repeats a condition check with exponential backoff.

forever

forever calls f every period for ever.

jitter

jitter returns a Duration between duration and duration + max_factor * duration.

jitter_until

jitter_until loops until stop channel is closed, running f every period.

non_sliding_until

non_sliding_until loops until stop channel is closed, running f every period.

poll

poll tries a condition func until it returns true, an error, or the timeout is reached.

poll_immediate

poll_immediate tries a condition func until it returns true, an error, or the timeout is reached.

poll_immediate_infinite

poll_immediate_infinite tries a condition func until it returns true or an error

poll_immediate_until

poll_immediate_until tries a condition func until it returns true, an error or stop_ch is closed.

poll_infinite

poll_infinite tries a condition func until it returns true or an error

poll_until

poll_until tries a condition func until it returns true, an error or stop_ch is closed.

until

until loops until stop channel is closed, running f every period.

wait_for

wait_for continually checks 'fn' as driven by 'wait'.