wait

package
v2.21.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Poll

func Poll(ctx context.Context, interval, timeout time.Duration, condition ConditionFunc) error

Poll works identically to k8swait.Poll, with the exception that a condition must return an error/nil to indicate a successful condition. In case a timeout occurs, the transient error is returned as part of the k8swait.ErrWaitTimeout, but note that the ErrWaitTimeout is being wrapped and the transient error only included as a string.

func PollImmediate

func PollImmediate(ctx context.Context, interval, timeout time.Duration, condition ConditionFunc) error

PollImmediate works identically to k8swait.PollImmediate, with the exception that a condition must return an error/nil to indicate a successful condition. In case a timeout occurs, the transient error is returned as part of the k8swait.ErrWaitTimeout, but note that the ErrWaitTimeout is being wrapped and the transient error only included as a string.

func PollImmediateLog

func PollImmediateLog(ctx context.Context, log *zap.SugaredLogger, interval, timeout time.Duration, condition ConditionFunc) error

PollImmediateLog is an extension of PollImmediate and will, if a transient error occurs, log that error on the INFO level using the given logger. Use this if you want continuous feedback and make sure to set a sensible interval like 5+ seconds.

func PollLog

func PollLog(ctx context.Context, log *zap.SugaredLogger, interval, timeout time.Duration, condition ConditionFunc) error

PollLog is an extension of Poll and will, if a transient error occurs, log that error on the INFO level using the given logger. Use this if you want continuous feedback and make sure to set a sensible interval like 5+ seconds.

Types

type ConditionFunc

type ConditionFunc func() (transient error, terminal error)

type PollFunc

type PollFunc func(interval, timeout time.Duration, condition k8swait.ConditionFunc) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL