package backoff

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/backoff"

Index

Variables

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

Functions

func Delay

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

func WithFastBackoff(fast Backoff) delayOption

func WithJitterLimit

func WithJitterLimit(jitterLimit float64) option

func WithSeed

func WithSeed(seed int64) option

func WithSlotDuration

func WithSlotDuration(slotDuration time.Duration) option

func WithSlowBackoff

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

Source Files

backoff.go delay.go type.go

Version
v3.94.0
Published
Dec 5, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
1 minute ago

Tools for package owners.