retry

package
v0.43.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBackoffStrategy

func DefaultBackoffStrategy() retry.Backoff

DefaultBackoffStrategy returns the default backoff strategy. The default backoff strategy is an exponential backoff with a maximum duration and maximum retries.

func RetryableError

func RetryableError(err error) error

RetryableError marks an error as retryable.

Types

type RetryConfig

type RetryConfig struct {
	// BackoffStrategy is the backoff strategy to use.
	BackoffStrategy retry.Backoff
}

RetryConfig is the configuration for a retry operation.

type Retryer

type Retryer struct {
	// contains filtered or unexported fields
}

Retryer is a utility for retrying functions.

func NewDefaultRetryer

func NewDefaultRetryer() *Retryer

NewDefaultRetryer creates a new Retryer with the default configuration. The default configuration is an exponential backoff with a maximum duration and maximum retries.

func NewNoOpRetryer

func NewNoOpRetryer() *Retryer

NewNoOpRetryer creates a new Retryer that does not retry. This is useful for testing.

func NewRetryer

func NewRetryer(config *RetryConfig) *Retryer

NewRetryer creates a new Retryer with the given configuration. If either the config or config.BackoffStrategy are nil, the default configuration is used. The default configuration is an exponential backoff with a maximum duration and maximum retries.

func (*Retryer) RetryFunc

func (r *Retryer) RetryFunc(ctx context.Context, f func(ctx context.Context) error) error

RetryFunc retries the given function with the backoff strategy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL