Documentation
¶
Overview ¶
Package wait provides tools for polling or listening for changes
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Jitter ¶ added in v0.3.0
Jitter returns a time.Duration between duration and duration + maxFactor * duration.
func Poll ¶
func Poll(ctx context.Context, conditionFunc ConditionWithContextFunc, opts ...OptionFunc) error
Poll polls a condition until it returns true, an error, or the timeout is reached.
Types ¶
type ConditionWithContextFunc ¶
type ConditionWithContextFunc = wait.ConditionWithContextFunc
ConditionWithContextFunc is a function that can be used to poll a condition
type OptionFunc ¶
type OptionFunc func(*Options)
OptionFunc is a function that can be used to configure the wait
func WithContinueOnError ¶
func WithContinueOnError(continueOnError int) OptionFunc
WithContinueOnError configures the number of times the wait should continue on error
func WithExponentialBackoff ¶
func WithExponentialBackoff(backoff *Backoff) OptionFunc
WithExponentialBackoff configures the wait to use exponential backoff
func WithImmediate ¶
func WithImmediate() OptionFunc
WithImmediate configures the wait to be immediate
func WithInterval ¶
func WithInterval(interval time.Duration) OptionFunc
WithInterval configures the interval for the wait
func WithTimeout ¶
func WithTimeout(timeout time.Duration) OptionFunc
WithTimeout configures the timeout for the wait
type Options ¶
type Options struct { // Interval is used to specify the interval for the wait Interval time.Duration // Timeout is used to specify the timeout for the wait Timeout time.Duration // Immediate is used to indicate if the wait should be immediate Immediate bool // ContinueOnError is used to specify the number of times the wait should continue on error ContinueOnError int // Backoff is used to specify the backoff for the wait Backoff *Backoff }
Options is used to configure the wait