package retry
import "github.com/google/go-containerregistry/internal/retry"
Package retry provides methods for retrying operations. It is a thin wrapper around k8s.io/apimachinery/pkg/util/wait to make certain operations easier.
Index ¶
- func Ever(ctx context.Context) bool
- func IsNotNil(err error) bool
- func IsTemporary(err error) bool
- func Never(ctx context.Context) context.Context
- func Retry(f func() error, p Predicate, backoff wait.Backoff) (err error)
- type Backoff
- type Predicate
Functions ¶
func Ever ¶
Ever returns true if the context was wrapped by Never.
func IsNotNil ¶
IsNotNil returns true if err is not nil.
func IsTemporary ¶
IsTemporary returns true if err implements Temporary() and it returns true.
func Never ¶
Never returns a context that signals something should not be retried. This is a hack and can be used to communicate across package boundaries to avoid retry amplification.
func Retry ¶
Retry retries a given function, f, until a predicate is satisfied, using exponential backoff. If the predicate is never satisfied, it will return the last error returned by f.
Types ¶
type Backoff ¶
Backoff is an alias of our own wait.Backoff to avoid name conflicts with the kubernetes wait package. Typing retry.Backoff is aesier than fixing the wrong import every time you use wait.Backoff.
type Predicate ¶
Predicate determines whether an error should be retried.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal/retry/wait | Package wait is a subset of k8s.io/apimachinery to avoid conflicts in dependencies (specifically, logging). |
- Version
- v0.20.3 (latest)
- Published
- Jan 15, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 16 hours ago –
Tools for package owners.