Documentation
¶
Overview ¶
Package backoff provides stateless methods of calculating durations based on a number of attempts made.
Index ¶
- type Algorithm
- func BinaryExponential(factor time.Duration) Algorithm
- func Constant(duration time.Duration) Algorithm
- func Exponential(factor time.Duration, base float64) Algorithm
- func Fibonacci(factor time.Duration) Algorithm
- func Incremental(initial, increment time.Duration) Algorithm
- func Linear(factor time.Duration) Algorithm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
Algorithm defines a function that calculates a time.Duration based on the given retry attempt number.
func BinaryExponential ¶
BinaryExponential creates an Algorithm that multiplies the factor duration by an exponentially increasing factor for each attempt, where the factor is calculated as 2 raised to the attempt number (2^attempt).
func Exponential ¶
Exponential creates an Algorithm that multiplies the factor duration by an exponentially increasing factor for each attempt, where the factor is calculated as the given base raised to the attempt number.
func Fibonacci ¶
Fibonacci creates an Algorithm that multiplies the factor duration by an increasing factor for each attempt, where the factor is the Nth number in the Fibonacci sequence.
func Incremental ¶
Incremental creates an Algorithm that increments the initial duration by the given increment for each attempt.