watcher

package
v0.15.2-dev Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectWatcher

type ObjectWatcher struct {
	// contains filtered or unexported fields
}

ObjectWatcher will block and watch or retry some operation on an object until a timeout, or some condition is true.

func ForObject

func ForObject(
	ctx context.Context, clientForResource dynamic.ResourceInterface, name string,
) *ObjectWatcher

ForObject creates an `ObjectWatcher` to watch some object.

func (*ObjectWatcher) RetryUntil

func (ow *ObjectWatcher) RetryUntil(r Retry, timeout time.Duration) error

RetryUntil will block and retry getting an object until the `Retry` operation succeeds (i.e., does not return an error).

func (*ObjectWatcher) WatchUntil

func (ow *ObjectWatcher) WatchUntil(pred Predicate, timeout time.Duration) error

WatchUntil will block and watch an object until some predicate is true, or a timeout occurs.

type Predicate

type Predicate func(*unstructured.Unstructured) bool

Predicate is a function that returns true when we can stop watching in `WatchUntil`.

type Retry

type Retry func(*unstructured.Unstructured, error) error

Retry is a function that returns nil when an operation that can fail some number of times has succeeded, and `RetryUntil` can stop retrying.

type RetryError

type RetryError struct {
	Err       error
	Retryable bool
}

RetryError is the required return type of RetryFunc. It forces client code to choose whether or not a given error is retryable.

func RetryableError

func RetryableError(err error) *RetryError

RetryableError is a helper to create a RetryError that's retryable from a given error.

func (RetryError) Error

func (re RetryError) Error() string

Jump to

Keyboard shortcuts

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