Versions in this module Expand all Collapse all v1 v1.0.0 Aug 8, 2026 Changes in this version + const DefaultInitialInterval + const DefaultMaxElapsedTime + const DefaultMaxInterval + const DefaultMultiplier + const DefaultRandomizationFactor + const Stop + var ErrExhausted = errors.New("backoff: retries exhausted") + var ErrMaxElapsedTime = errors.New("backoff: maximum elapsed time exceeded") + var ErrPermanent = errors.New("backoff: permanent error") + func Permanent(err error) error + func RetryAfter(d time.Duration, cause error) error + func Retry[T any](ctx context.Context, operation Operation[T], opts ...RetryOption) (T, error) + type BackOff interface + NextBackOff func() time.Duration + Reset func() + type ConstantBackOff struct + Interval time.Duration + func NewConstantBackOff(d time.Duration) *ConstantBackOff + func (b *ConstantBackOff) NextBackOff() time.Duration + func (b *ConstantBackOff) Reset() + type ExponentialBackOff struct + InitialInterval time.Duration + MaxInterval time.Duration + Multiplier float64 + RandomizationFactor float64 + func NewExponentialBackOff() *ExponentialBackOff + func (b *ExponentialBackOff) NextBackOff() time.Duration + func (b *ExponentialBackOff) Reset() + type Notify func(error, time.Duration) + type Operation func() (T, error) + type RetryAfterError struct + Duration time.Duration + func (e *RetryAfterError) Error() string + func (e *RetryAfterError) Unwrap() error + type RetryError struct + Cause error + LastErr error + func AsRetryError(err error) *RetryError + func (e *RetryError) Error() string + func (e *RetryError) Unwrap() []error + type RetryOption func(*retryOptions) + func WithBackOff(b BackOff) RetryOption + func WithMaxElapsedTime(d time.Duration) RetryOption + func WithMaxTries(n uint) RetryOption + func WithNotify(n Notify) RetryOption + type StopBackOff struct + func (b *StopBackOff) NextBackOff() time.Duration + func (b *StopBackOff) Reset() + type Ticker struct + C <-chan time.Time + func NewTicker(b BackOff) *Ticker + func (t *Ticker) Stop() + type ZeroBackOff struct + func (b *ZeroBackOff) NextBackOff() time.Duration + func (b *ZeroBackOff) Reset()