extension

package
v0.0.0-...-6976cfd Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpenCircuitError = errors.New("open circuit breaker")

OpenCircuitError error is returned when circuit is open.

View Source
var RetryExceeded = errors.New("retry attempts exceeded")

RetryExceeded represents the error returned when client fail to send request after retry.

View Source
var (
	TimeOutError = errors.New("Timeout")
)

Functions

func Decorate

func Decorate(rs protocol.Sender, exts ...Extension) protocol.Sender

Decorate wraps a sender using the given client extensions.

Types

type Extension

type Extension func(protocol.Sender) protocol.Sender

Extension define a decorator to apply on client for customization purposes.

func NewCircuitBreakerExt

func NewCircuitBreakerExt(cb *circuit.Breaker) Extension

NewCircuitBreakerExt returns an extension that implements the circuit breaker pattern. Currently no remote exception is counted. FIXME: extensions are client specific this mean that all requests share same cb.

func NewRetryExt

func NewRetryExt(maxTries int, backoff backoff.BackOff) Extension

NewRetryExt returns an extension that wraps a client to retry failed requests using given backoff. This extension assuming nothing about whether service is idempotent or not, only request that are not sent are retried. FIXME: Middlewares are client specific this mean that all requests share the same backoff.

func NewTimeoutExt

func NewTimeoutExt(timeout time.Duration) Extension

NewTimeoutExt returns an extension that wraps a client to timeout a request when this later take more than given duration.

Jump to

Keyboard shortcuts

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