Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectedError ¶
ExpectedError error represents an error that is expected by the retrying function. This error is ignored.
func UnexpectedError ¶
UnexpectedError error represents an error that is unexpected by the retrying function. This error is fatal.
Types ¶
type ConstantTicker ¶
type ConstantTicker struct {
// contains filtered or unexported fields
}
ConstantTicker represents a ticker with a constant algorithm.
func NewConstantTicker ¶
func NewConstantTicker(opts *Options) *ConstantTicker
NewConstantTicker is a ticker that sends the time on a channel using a constant algorithm.
func (ConstantTicker) Tick ¶
func (c ConstantTicker) Tick() time.Duration
Tick implements the Ticker interface.
type ErrorSet ¶
type ErrorSet struct {
// contains filtered or unexported fields
}
ErrorSet represents a set of unique errors.
type ExponentialTicker ¶
type ExponentialTicker struct {
// contains filtered or unexported fields
}
ExponentialTicker represents a ticker with a truncated exponential algorithm. Please see https://en.wikipedia.org/wiki/Exponential_backoff for details on the algorithm.
func NewExponentialTicker ¶
func NewExponentialTicker(opts *Options) *ExponentialTicker
NewExponentialTicker is a ticker that sends the time on a channel using a truncated exponential algorithm.
func (*ExponentialTicker) Tick ¶
func (e *ExponentialTicker) Tick() time.Duration
Tick implements the Ticker interface.
type LinearTicker ¶
type LinearTicker struct {
// contains filtered or unexported fields
}
LinearTicker represents a ticker with a linear algorithm.
func NewLinearTicker ¶
func NewLinearTicker(opts *Options) *LinearTicker
NewLinearTicker is a ticker that sends the time on a channel using a linear algorithm.
func (*LinearTicker) Tick ¶
func (l *LinearTicker) Tick() time.Duration
Tick implements the Ticker interface.
type Option ¶
type Option func(*Options)
Option is the functional option func.
func WithJitter ¶
WithJitter is a functional option for setting the jitter flag.
type Options ¶
Options is the functional options struct.
func NewDefaultOptions ¶
NewDefaultOptions initializes a Options struct with default values.
type RetryableFunc ¶
type RetryableFunc func() error
RetryableFunc represents a function that can be retried.
type Retryer ¶
type Retryer interface {
Retry(RetryableFunc) error
}
Retryer defines the requirements for retrying a function.
func Exponential ¶
Exponential initializes and returns a truncated exponential Retryer.
type TimeoutError ¶
type TimeoutError struct{}
TimeoutError represents a timeout error.
func (TimeoutError) Error ¶
func (TimeoutError) Error() string