Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	Duration(attempts uint) time.Duration
}

Backoff is an algorithm for determining how long to wait after a number of attempts to perform some action. Backoff strategies typically use a random number generator that uses some state for feedback. Instances of backoff are intended to be used in the stack of a single goroutine and must therefore either be referentially independent or lock safe.

type Strategy

type Strategy interface {
	Backoff() Backoff
}

Strategy is a factory for backoff algorithms. Each backoff instance may capture some state, typically a random number generator. The strategy guarantees that these backoff instances are either referentially independent and lockless or thread safe.

Backoff strategies are useful for configuring retry loops, balancing the need to recover quickly against denial of service as a failure mode.

var None Strategy = &none{}

None is a shorted backoff strategy that will always produce a 0ms duration. This strategy is intended to minimize arbitrary delays during tests or maximize load on a benchmark.

Source Files