Documentation
¶
Index ¶
- Variables
- func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc
- func WithRetry[T any](ctx context.Context, logger func([]byte), f func(context.Context) (T, error)) (T, error)
- func WithRetryIf[T any](ctx context.Context, logger func([]byte), f func(context.Context) (T, error), ...) (T, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MaxRetryBackoff = 8 * time.Second
MaxRetryBackoff is the maximum backoff time before giving up. This is a variable so that code which embeds BuildKit can override the default value.
Functions ¶
func New ¶
func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc
func WithRetry ¶
func WithRetry[T any](ctx context.Context, logger func([]byte), f func(context.Context) (T, error)) (T, error)
WithRetry retries transient failures with exponential backoff. Nested calls using the supplied context leave retries to the outer call, including New. f must be safe to retry and preserve retryable errors when wrapping them.
func WithRetryIf ¶
func WithRetryIf[T any](ctx context.Context, logger func([]byte), f func(context.Context) (T, error), shouldRetry func(error) bool) (T, error)
WithRetryIf applies the normal retry policy only when shouldRetry also accepts the error. A nil predicate accepts all errors in the normal policy. This lets callers avoid retrying errors handled by an enclosing transport.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.