retries

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backoff

func Backoff(attempt int) time.Duration

func Poll

func Poll[T any](pctx context.Context, timeout time.Duration, fn func() (*T, *Err)) (*T, error)

func Wait

func Wait(pctx context.Context, timeout time.Duration, fn WaitFn) error

Types

type Err

type Err struct {
	Err  error
	Halt bool
}

func Continue

func Continue(err error) *Err

func Continuef

func Continuef(format string, err error, args ...interface{}) *Err

func Continues

func Continues(msg string) *Err

func Halt

func Halt(err error) *Err

type ErrTimedOut added in v0.26.0

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

func (*ErrTimedOut) Error added in v0.26.0

func (et *ErrTimedOut) Error() string

func (*ErrTimedOut) Unwrap added in v0.26.0

func (et *ErrTimedOut) Unwrap() error

type Info deprecated

type Info[T any] struct {
	Info    *T
	Timeout time.Duration
}

Deprecated: use return types from non-*AndWait methods

type Option deprecated

type Option[T any] func(*Info[T])

Deprecated: use return types from non-*AndWait methods

func OnPoll deprecated added in v0.2.0

func OnPoll[T any](callback func(*T)) Option[T]

Deprecated: use return types from non-*AndWait methods

func Timeout deprecated

func Timeout[T any](dur time.Duration) Option[T]

Deprecated: use return types from non-*AndWait methods

type WaitFn

type WaitFn func() *Err

Jump to

Keyboard shortcuts

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