backoff

package
v3.54.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 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 New

func New(opts ...option) logBackoff

func WithCeiling

func WithCeiling(ceiling uint) option

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

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