wait

package
v2.26.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 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 context.DeadlineExceeded, but note that the DeadlineExceeded 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 context.DeadlineExceeded, but note that the DeadlineExceeded 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(ctx context.Context) (transient error, terminal error)

type PollFunc

type PollFunc func(ctx context.Context, interval, timeout time.Duration, immediate bool, condition k8swait.ConditionWithContextFunc) error

Jump to

Keyboard shortcuts

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