Documentation ¶
Overview ¶
Package backoff implements different backoff strategies for retrying failed operations in VTAdmin.
It is first a reimplementation of grpc-go's internal exponential backoff strategy, with one modification to prevent a jittered backoff from exceeding the MaxDelay specified in a config.
Then, for other use-cases, it implements a linear backoff strategy, as well as a "none" strategy which is primarly intended for use in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultExponential = Exponential{grpcbackoff.DefaultConfig} DefaultLinear = Linear{grpcbackoff.DefaultConfig} DefaultNone = None{} )
Functions ¶
This section is empty.
Types ¶
type Exponential ¶
type Exponential struct {
Config grpcbackoff.Config
}
Exponential implements an exponential backoff strategy with optional jitter.
type Linear ¶
type Linear struct {
Config grpcbackoff.Config
}
Linear implements a linear backoff strategy with optional jitter.
type None ¶
type None struct{}
None implements a "backoff" strategy that can be summarized as "don't".
type Strategy ¶
type Strategy interface { // Backoff returns the amount of time to backoff for the given retry count. Backoff(retries int) time.Duration }
Strategy defines the interface for different backoff strategies.
func Get ¶
func Get(strategy string, cfg grpcbackoff.Config) Strategy
Get returns a backoff Strategy for the specified strategy name, with the given config. Strategy lookup is case-insensitive, and the empty string defaults to an exponential strategy. It panics if an unsupported strategy name is specified.
Currently-supported strategies are "exponential", "linear", and "none".