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 New

func New(opts ...option) logBackoff

func WithCeiling

func WithCeiling(ceiling uint) option

func WithClock

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

Source Files

backoff.go type.go

Version
v3.40.1
Published
Nov 23, 2022
Platform
linux/amd64
Imports
5 packages
Last checked
1 minute ago

Tools for package owners.