backoff

package
v0.0.0-...-23becbe Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrorMaxBackOff

func IsErrorMaxBackOff(err error) bool

func IsErrorMaxRetries

func IsErrorMaxRetries(err error) bool

Types

type ActionHandler

type ActionHandler func() (interface{}, error)

type Adapter

type Adapter interface {
	Start(input *Config) Adapter
	Duration() time.Duration
	Continue() bool
	State() State
	Reset()
	GetCurrentBackoff() int
	GetCurrentRetries() int
}

type Builder

type Builder interface {
	Try(action ActionHandler) Output
}

type Config

type Config struct {
	Initial    int
	Max        int
	Multiplier int
	Jitter     int
	Retries    int
}

type Operator

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

func NewOperator

func NewOperator(input *Config, adapter Adapter) *Operator

func (*Operator) Try

func (o *Operator) Try(action ActionHandler) Output

type Output

type Output struct {
	Value interface{}
	Err   error
}

type State

type State string
const (
	BackoffInitiated   State = "backoff initiated"
	MaxRetriesAchieved State = "max retries has been achieved"
	MaxBackOffAchieved State = "max backoff has been achieved"
)

func (State) String

func (s State) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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