Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(r *Retriable)
Option is a functional option for a Retriable
func WithDuration ¶
WithDuration sets the waiter to use a Duration WaiterFunc with the specified duration
func WithExponentialBackoff ¶
WithExponentialBackoff sets the waiter to use an ExponentialBackoff WaiterFunc with the specified duration
func WithIncrementalBackoff ¶
WithIncrementalBackoff sets the waiter to use an IncrementalBackoff WaiterFunc with the specified duration
func WithMaxAttempts ¶
WithMaxAttempts sets the maximum number of attempts for a Retriable
func WithMaxWait ¶
WithMaxWait sets the maximum amount of duration to wait between retries, regardless of what is returned from the Waiter
func WithWaiter ¶
WithWaiter sets the waiter used to determine the amount of time to wait between retries for a Retriable
type PermanentError ¶
type PermanentError struct {
// contains filtered or unexported fields
}
PermanentError signals that the operation should not be retried
func Permanent ¶
func Permanent(err error) PermanentError
Permanent wraps the given err in a PermanentError
type Retriable ¶
type Retriable struct {
// contains filtered or unexported fields
}
Retriable represents an action that is retriable given an error
func Default ¶
func Default() *Retriable
Default creates a new Retriable that retries 3 times, sleeping for a second between each retry
type Waiter ¶
Waiter is an interface that determines the amount of time to wait in between retries given the number of attempts and error that occurred
type WaiterFunc ¶
WaiterFunc is a function that can act as a Waiter
func Duration ¶
func Duration(d time.Duration) WaiterFunc
Duration is a WaiterFunc that waits for a static duration
func ExponentialBackoff ¶
func ExponentialBackoff(d time.Duration) WaiterFunc
ExponentialBackoff is a WaiterFunc that waits for a duration d multiplied by the number of attempts^2 that have occurred for the Retriable ex: 1, 4, 9, 16, 25 * time.Seconds
func IncrementalBackoff ¶
func IncrementalBackoff(d time.Duration) WaiterFunc
IncrementalBackoff is a WaiterFunc that waits for a duration d multiplied by the number of attempts that have occurred for the Retriable ex: 1, 2, 3, 4, 5 * time.Seconds