Documentation
¶
Index ¶
- Constants
- func For(f func() (bool, error), options ...Option) error
- type Logger
- type O
- type Option
- func ExitOnError(exit bool) Option
- func WithBackoff(f float64) Option
- func WithContext(ctx context.Context) Option
- func WithDescription(s string) Option
- func WithInterval(d time.Duration) Option
- func WithLimit(d time.Duration) Option
- func WithLogger(f Logger) Option
- func WithMaxInterval(d time.Duration) Option
- func WithMinInterval(d time.Duration) Option
- func WithReporter(f Reporter) Option
- func WithReports(n int) Option
- type Reporter
Constants ¶
const ErrTimeout errors.String = "timeout"
Variables ¶
This section is empty.
Functions ¶
func For ¶
For calls a function repeatedly. It will stop calling and return ErrTimeout if too much time has passed. Otherwise it stops when the function returns true. If the function returns (true, error), then For() returns that error. An error return from function parameter does not cause the loop to exit unless ExitOnError(true) is is set.
Types ¶
type Option ¶
type Option func(*O)
func ExitOnError ¶
func WithBackoff ¶
WithBackoff sets how much the interval should change after the function is called. Reasonable values are in the range 1.01 to 1.04. The default is 1.02. Do not set this to a value that is < 1.0.
func WithContext ¶
func WithDescription ¶
func WithInterval ¶
WithInterval sets both the minimum and maximum intervals
func WithLogger ¶
func WithMaxInterval ¶
func WithMinInterval ¶
func WithReporter ¶
func WithReports ¶
WithReports specifies that there be approximately N progress reports before timeout. Values must be 0 and above.