backoff

package
v1.1.0-beta.0...-5fbe4fb Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoffer

type Backoffer struct {
	// contains filtered or unexported fields
}

Backoffer wraps tikv.Backoffer and converts the error which returns by the functions of tikv.Backoffer to tidb error.

func NewBackoffer

func NewBackoffer(ctx context.Context, maxSleep int) *Backoffer

NewBackoffer creates a Backoffer with maximum sleep time(in ms).

func NewBackofferWithTikvBo

func NewBackofferWithTikvBo(bo *tikv.Backoffer) *Backoffer

NewBackofferWithTikvBo creates a Backoffer with tikv.Backoffer

func NewBackofferWithVars

func NewBackofferWithVars(ctx context.Context, maxSleep int, vars *kv.Variables) *Backoffer

NewBackofferWithVars creates a Backoffer with maximum sleep time(in ms) and kv.Variables.

func (*Backoffer) Backoff

func (b *Backoffer) Backoff(cfg *tikv.BackoffConfig, err error) error

Backoff sleeps a while base on the BackoffConfig and records the error message. It returns a retryable error if total sleep time exceeds maxSleep.

func (*Backoffer) BackoffWithMaxSleepTxnLockFast

func (b *Backoffer) BackoffWithMaxSleepTxnLockFast(maxSleepMs int, err error) error

BackoffWithMaxSleepTxnLockFast sleeps a while for the operation TxnLockFast and records the error message and never sleep more than maxSleepMs for each sleep.

func (*Backoffer) GetBackoffSleepMS

func (b *Backoffer) GetBackoffSleepMS() map[string]int

GetBackoffSleepMS returns a map contains backoff sleep time by type.

func (*Backoffer) GetBackoffTimes

func (b *Backoffer) GetBackoffTimes() map[string]int

GetBackoffTimes returns a map contains backoff time count by type.

func (*Backoffer) GetCtx

func (b *Backoffer) GetCtx() context.Context

GetCtx returns the binded context.

func (*Backoffer) GetTotalSleep

func (b *Backoffer) GetTotalSleep() int

GetTotalSleep returns total sleep time.

func (*Backoffer) GetVars

func (b *Backoffer) GetVars() *tikv.Variables

GetVars returns the binded vars.

func (*Backoffer) TiKVBackoffer

func (b *Backoffer) TiKVBackoffer() *tikv.Backoffer

TiKVBackoffer returns tikv.Backoffer.

Jump to

Keyboard shortcuts

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