Documentation ¶
Index ¶
- func Do(parent context.Context, operation Operation, opts ...Option) error
- func GetBackoffDurationInMs(backoffBaseInMs, backoffCapInMs, attempt float64) time.Duration
- func Prepare(opts ...Option) func(parent context.Context, operation Operation) error
- type IsIrrevocableErr
- type Operation
- type Option
- func WithBackoffBaseDelay(delayInMs int64) Option
- func WithBackoffMaxDelay(delayInMs int64) Option
- func WithCustomTags(tag ...string) Option
- func WithInfiniteAttempts() Option
- func WithIsIrrevocableErrorHandler(fn func(error) (noRetry bool)) Option
- func WithMaxAttempts(attempts int) Option
- func WithName(name string) Option
- type Throttler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBackoffDurationInMs ¶
GetBackoffDurationInMs returns a backoff duration to avoid access contention Ref: https://www.awsarchitectureblog.com/2015/03/backoff.html
Types ¶
type IsIrrevocableErr ¶
IsIrrevocableErr is a function that checks the supplied error and decides if the function should be retried or if we should immediately give up. For example, "data not found", "deadline exceeded" or "permission denied"
type Operation ¶
type Operation func() error
Operation defines the function signature for actions needed retry
type Option ¶
type Option func(*retryOptions)
Option is a function that configures retry operations
func WithBackoffBaseDelay ¶
WithBackoffBaseDelay configures the retryer to use the provided maximum delay when backing off after failed connection attempts.
func WithBackoffMaxDelay ¶
WithBackoffMaxDelay configures the retryer to use the provided maximum delay when backing off after failed connection attempts.
func WithCustomTags ¶
WithCustomTags configures the retyer with custom statsd tags to be tracked
func WithInfiniteAttempts ¶
func WithInfiniteAttempts() Option
WithInfiniteAttempts configures the retryer to hve no maximum retry limit, ie. continue retrying forever
func WithIsIrrevocableErrorHandler ¶
WithIsIrrevocableErrorHandler configures the retryer to use the provided error handler
func WithMaxAttempts ¶
WithMaxAttempts configures the retryer to use the provided maximum attempts count when backing off after failed connection attempts.