Documentation
¶
Index ¶
- func InitHttpClientConf(conf map[string]config.HttpClientConf)
- func InitHttpClientConfWithPorm(conf map[string]config.HttpClientConf, promClient **broccoliprometheus.Prom)
- type Backoff
- type Client
- func (c *Client) Delete(ctx context.Context, url string, headers map[string]string) ([]byte, error)
- func (c *Client) Get(ctx context.Context, url string, headers map[string]string) ([]byte, error)
- func (c *Client) GetHttpClient(instance string) (zhttpclient.Client, error)
- func (c *Client) Patch(ctx context.Context, url string, body io.Reader, headers map[string]string) ([]byte, error)
- func (c *Client) Post(ctx context.Context, url string, body io.Reader, headers map[string]string) ([]byte, error)
- func (c *Client) Put(ctx context.Context, url string, body io.Reader, headers map[string]string) ([]byte, error)
- type Retriable
- type RetriableFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitHttpClientConf ¶
func InitHttpClientConf(conf map[string]config.HttpClientConf)
func InitHttpClientConfWithPorm ¶
func InitHttpClientConfWithPorm(conf map[string]config.HttpClientConf, promClient **broccoliprometheus.Prom)
Types ¶
type Backoff ¶
Backoff interface defines contract for backoff strategies
func NewConstantBackoff ¶
NewConstantBackoff returns an instance of ConstantBackoff The maximum jitter interval must be more than 1*time.Millisecond
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func DefaultClient ¶
func DefaultClient() *Client
func (*Client) GetHttpClient ¶
func (c *Client) GetHttpClient(instance string) (zhttpclient.Client, error)
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)
Click to show internal directories.
Click to hide internal directories.