Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
Backoff interface defines contract for backoff strategies
func NewConstantBackoff ¶
NewConstantBackoff returns an instance of ConstantBackoff
type Client ¶
type Client interface { Get(url string, headers http.Header) (*http.Response, error) Post(url string, body io.Reader, headers http.Header) (*http.Response, error) Put(url string, body io.Reader, headers http.Header) (*http.Response, error) Patch(url string, body io.Reader, headers http.Header) (*http.Response, error) Delete(url string, headers http.Header) (*http.Response, error) Do(req *http.Request) (*http.Response, error) Options() Options }
Client http client interface
type Option ¶
type Option func(opts *Options)
Option ...
func WithHTTPTimeout ¶
WithHTTPTimeout sets hystrix timeout
func WithMiddleware ¶
func WithMiddleware(m Middleware) Option
WithMiddleware sets the strategy for retrying
func WithRetrier ¶
WithRetrier sets the strategy for retrying
func WithRetryCount ¶
WithRetryCount sets the retry count for the client
type Options ¶
type Options struct { Retrier Retriable Timeout time.Duration RetryCount int Middles []Middleware }
Options represents the http client options
type Retriable ¶
Retriable defines contract for retriers to implement
func NewRetrier ¶
NewRetrier returns retrier with some backoff strategy
func NewRetrierFunc ¶
func NewRetrierFunc(f RetriableFunc) Retriable
NewRetrierFunc returns a retrier with a retry function defined
type RetriableFunc ¶
RetriableFunc is an adapter to allow the use of ordinary functions as a Retriable
func (RetriableFunc) NextInterval ¶
func (f RetriableFunc) NextInterval(retry int) time.Duration
NextInterval calls f(retry)