backoff

package
v3.44.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Fast = New(
		WithSlotDuration(fastSlot),
		WithCeiling(6),
	)
	Slow = New(
		WithSlotDuration(slowSlot),
		WithCeiling(6),
	)
)

Functions

func New

func New(opts ...option) logBackoff

func WithCeiling

func WithCeiling(ceiling uint) option

func WithClock added in v3.26.0

func WithClock(clock clockwork.Clock) option

func WithJitterLimit

func WithJitterLimit(jitterLimit float64) option

func WithSlotDuration

func WithSlotDuration(slotDuration time.Duration) option

Types

type Backoff

type Backoff interface {
	// Wait maps index of the retry to a channel which fulfillment means that
	// Delay is over.
	//
	// Note that retry index begins from 0 and 0-th index means that it is the
	// first retry attempt after an initial error.
	Wait(n int) <-chan time.Time

	// Delay returns mapping of i to Delay.
	Delay(i int) time.Duration
}

Backoff is the interface that contains logic of delaying operation retry.

type Type

type Type uint8

Type reports how to Backoff operation

const (
	TypeNoBackoff Type = 1 << iota >> 1

	TypeFast
	TypeSlow

	TypeAny = TypeFast | TypeSlow
)

Binary flags that used as Type

func (Type) String

func (b Type) String() string

Jump to

Keyboard shortcuts

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