Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff interface { // Next returns the duration to wait before performing the next attempt. Next(attempt int) time.Duration }
Backoff describes the backoff interface.
func NewConstantBackoff ¶
NewConstantBackoff returns an instance of ConstantBackoff.
func NewExponentialBackoff ¶
NewExponentialBackoff returns an instance of ExponentialBackoff.
type NoAttemptsAllowedError ¶
type NoAttemptsAllowedError struct {
MaxAttempts int
}
NoAttemptsAllowedError is used to signal that no attempts are allowed.
func (*NoAttemptsAllowedError) Error ¶
func (e *NoAttemptsAllowedError) Error() string
Error returns the error message.
type Option ¶
type Option func(r *Retry)
Option is an option to add to the Retry.
func WithMaxAttempts ¶
WithMaxAttempts sets a the maximum number of attempts to perform.
type Policy ¶
Policy describes the retry policy based on the error. It must return true for retryable errors and false otherwise.
type Retry ¶
type Retry struct {
// contains filtered or unexported fields
}
Retry allows to retry a function until the amount of attempts is exhausted, using a backoff mechanism to wait between successive attempts. By default, there retrier will:
- attempts ad infinitum
- not observe wait between successive attempts
- retry on all errors