retry

package
v0.1.75 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func() error

Callback is a callback that must return nil to escape the retry loop.

type Error

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

Error allows the last error to be retrieved.

func (*Error) Callback

func (e *Error) Callback() error

Callback gets the last callback error.

func (*Error) Context

func (e *Error) Context() error

Context gets the context error.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) Unwrap

func (e *Error) Unwrap() []error

Unwrap allows access to either of the errors via errors.Is or errors.As.

type Retrier

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

Retrier implements retry loop logic.

func Forever

func Forever() *Retrier

Froever returns a retrier that will retry soething forever until a nil error is returned.

func (*Retrier) Do

func (r *Retrier) Do(f Callback) error

Do starts the retry loop. It will run until success or until an optional timeout expires.

func (*Retrier) DoWithContext

func (r *Retrier) DoWithContext(c context.Context, f Callback) error

DoWithContext allows you to use a global context to interrupt execution.

Jump to

Keyboard shortcuts

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