retries

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package retries implements backoff strategies around a standard configuration scheme.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldSpecs

func FieldSpecs() docs.FieldSpecs

FieldSpecs returns documentation specs for retry fields.

Types

type Backoff

type Backoff struct {
	InitialInterval string `json:"initial_interval" yaml:"initial_interval"`
	MaxInterval     string `json:"max_interval" yaml:"max_interval"`
	MaxElapsedTime  string `json:"max_elapsed_time" yaml:"max_elapsed_time"`
}

Backoff contains configuration params for the exponential backoff of the retry mechanism.

type Config

type Config struct {
	MaxRetries uint64  `json:"max_retries" yaml:"max_retries"`
	Backoff    Backoff `json:"backoff" yaml:"backoff"`
}

Config contains configuration params for a retries mechanism.

func NewConfig

func NewConfig() Config

NewConfig creates a new Config with default values.

func (*Config) Get

func (c *Config) Get() (backoff.BackOff, error)

Get returns a valid *backoff.ExponentialBackoff based on the configuration values of Config.

func (*Config) GetCtor

func (c *Config) GetCtor() (func() backoff.BackOff, error)

GetCtor returns a constructor for a backoff.Backoff based on the configuration values of Config.

Jump to

Keyboard shortcuts

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