backoff

package
v0.0.0-...-19f3900 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

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

func New

func New(o Options) (*Backoff, error)

func (*Backoff) Next

func (b *Backoff) Next() (time.Duration, bool)

func (*Backoff) Reset

func (b *Backoff) Reset()

func (*Backoff) Retry

func (b *Backoff) Retry(ctx context.Context, err error) error

type Options

type Options struct {
	// Must be positive. Zero means default.
	Min time.Duration
	// Must be positive. Zero means default.
	Max time.Duration
	// Must be >= 1.0. Zero means default.
	Grow float64
	// Must be >= 1.0. Zero means default.
	Jitter float64
	// Zero means default, negative means unlimited.
	MaxAttempts int64
}

func (*Options) FillDefaults

func (o *Options) FillDefaults()

func (*Options) Validate

func (o *Options) Validate() error

Jump to

Keyboard shortcuts

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