Documentation
¶
Index ¶
- Variables
- type Backoff
- type BackoffConf
- type Classifier
- type Deadliner
- type Executor
- type Jitter
- type Retrier
- func NewExecutorRetrier(ex Executor, logger log.Logger, options ...RetrierOption) (*Retrier, error)
- func NewRetrier(logger log.Logger, fn endpoint.Endpoint, options ...RetrierOption) (*Retrier, error)
- func NewRetrierFromConfig(fn endpoint.Endpoint, lg log.Logger, cfg *RetrierConf, opts ...RetrierOption) (*Retrier, error)
- type RetrierConf
- type RetrierOption
- func WithClassifier(cl Classifier) RetrierOption
- func WithConstantBackoff(conf *BackoffConf) RetrierOption
- func WithLinearBackoff(conf *BackoffConf) RetrierOption
- func WithLogger(logger log.Logger) RetrierOption
- func WithRetrierEnable(en bool) RetrierOption
- func WithRetryCount(count int) RetrierOption
- type State
Constants ¶
This section is empty.
Variables ¶
var ( ErrInternalServer = errors.New("internal server error, response code > 500") ErrNotFound = errors.New("resource not found, response code = 404") ErrResponseIsNil = errors.New("'response' from downstream is nil") ErrExec = errors.New("executor failed") ErrRequestIsNotHTTP = errors.New("retrier request is not net_http.Request") ErrResponseIsNotHTTP = errors.New("retrier response is not net_http.Response") )
Functions ¶
This section is empty.
Types ¶
type BackoffConf ¶
type Classifier ¶
Classifier takes a given error generated by the Proxy and assigns a given state based on the error emitted
type Jitter ¶
Jitter defines the randomization strategy which is added to backoff timer to not clog the the downstream with simulteneous requests
type Retrier ¶
type Retrier struct {
// contains filtered or unexported fields
}
Retrier retries to perform a single operation multiple times based on the parameters provided
func NewExecutorRetrier ¶
func NewRetrier ¶
func NewRetrier(logger log.Logger, fn endpoint.Endpoint, options ...RetrierOption) (*Retrier, error)
NewRetrier returns a new Retrier
func NewRetrierFromConfig ¶
func NewRetrierFromConfig(fn endpoint.Endpoint, lg log.Logger, cfg *RetrierConf, opts ...RetrierOption) (*Retrier, error)
NewRetrierFromConfig returns a new retrier based on configuration
type RetrierConf ¶
type RetrierConf struct { // jitter & classifier can be taken from config // in similar fashion Backoff *BackoffConf // retry counts Count int // need to set in config, // default value is false for bool Enable bool }
type RetrierOption ¶
RetrierOption sets options for Retry
func WithClassifier ¶
func WithClassifier(cl Classifier) RetrierOption
func WithConstantBackoff ¶
func WithConstantBackoff(conf *BackoffConf) RetrierOption
WithConstantBackoff increments the timer with a constant value
func WithLinearBackoff ¶
func WithLinearBackoff(conf *BackoffConf) RetrierOption
WithLinearBackoff sets backoff as linear
func WithLogger ¶
func WithLogger(logger log.Logger) RetrierOption
WithLogger sets the logger for retrier
func WithRetrierEnable ¶
func WithRetrierEnable(en bool) RetrierOption
WithRetrierEnable sets if Retrier is enabled
func WithRetryCount ¶
func WithRetryCount(count int) RetrierOption
WithRetryCount sets custom retry count for Retrier