backoff

package
v3.92.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 4 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 Delay added in v3.66.0

func Delay(t Type, i int, opts ...delayOption) time.Duration

func New

func New(opts ...option) logBackoff

func WithCeiling

func WithCeiling(ceiling uint) option

func WithFastBackoff added in v3.66.0

func WithFastBackoff(fast Backoff) delayOption

func WithJitterLimit

func WithJitterLimit(jitterLimit float64) option

func WithSeed added in v3.52.0

func WithSeed(seed int64) option

func WithSlotDuration

func WithSlotDuration(slotDuration time.Duration) option

func WithSlowBackoff added in v3.66.0

func WithSlowBackoff(slow Backoff) delayOption

Types

type Backoff

type Backoff interface {
	// 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