Documentation ¶
Index ¶
Constants ¶
View Source
const Stop time.Duration = -1
Stop indicates that no more retries should be made.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backoff ¶
type Backoff interface { // Next gets the duration to wait before retrying the operation or |Stop| // to indicate that no retries should be made. Next() time.Duration // Reset resets to initial state. Reset() }
func NoRetries ¶
func NoRetries() Backoff
NoRetries returns a backoff that will do a single attempt, with no retries.
func WithMaxAttempts ¶
WithMaxAttempts wraps a back-off which stops after |max| attempts. If the max is 0, then it won't apply a maximum number attempts.
type ConstantBackoff ¶
type ConstantBackoff struct {
// contains filtered or unexported fields
}
ConstantBackoff is a fixed policy that always returns the same backoff delay.
func NewConstantBackoff ¶
func NewConstantBackoff(d time.Duration) *ConstantBackoff
func (*ConstantBackoff) Next ¶
func (b *ConstantBackoff) Next() time.Duration
func (*ConstantBackoff) Reset ¶
func (b *ConstantBackoff) Reset()
type ExponentialBackoff ¶
type ExponentialBackoff struct {
// contains filtered or unexported fields
}
ExponentialBackoff is a policy that increase the delay exponentially, with a small amount of randomness.
func NewExponentialBackoff ¶
func NewExponentialBackoff(initialInterval time.Duration, maxInterval time.Duration, multiplier float64) *ExponentialBackoff
NewExponentialBackoff returns a new ExponentialBackoff object.
func (*ExponentialBackoff) Next ¶
func (e *ExponentialBackoff) Next() time.Duration
func (*ExponentialBackoff) Reset ¶
func (e *ExponentialBackoff) Reset()
type ZeroBackoff ¶
type ZeroBackoff struct{}
ZeroBackoff is a fixed policy whose back-off time is always zero, meaning that the operation is retried immediately without waiting.
func (*ZeroBackoff) Next ¶
func (b *ZeroBackoff) Next() time.Duration
func (*ZeroBackoff) Reset ¶
func (b *ZeroBackoff) Reset()
Click to show internal directories.
Click to hide internal directories.