retry

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Retriable

type Retriable interface {
	NextInterval(retry int) time.Duration
	Do(fn RetryFunc, retries int) (err error)
}

Retriable defines contract for retriers to implement

func NewNoRetrier

func NewNoRetrier() Retriable

NewNoRetrier returns a null object for retriable

func NewRetrier

func NewRetrier(backoff backoff.Backoff) Retriable

NewRetrier returns retrier with some backoff strategy

func NewRetrierFunc

func NewRetrierFunc(f RetriableFunc) Retriable

NewRetrierFunc returns a retrier with a retry function defined

type RetriableFunc

type RetriableFunc func(retry int) time.Duration

RetriableFunc is an adapter to allow the use of ordinary functions as a Retriable

func (RetriableFunc) Do

func (f RetriableFunc) Do(fn RetryFunc, retries int) (err error)

func (RetriableFunc) NextInterval

func (f RetriableFunc) NextInterval(retry int) time.Duration

NextInterval calls f(retry)

type RetryFunc

type RetryFunc func() (err error)

func (RetryFunc) Do

func (f RetryFunc) Do() (err error)

Jump to

Keyboard shortcuts

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