Documentation
¶
Overview ¶
package bk is intended to create a client side load balancer or rate limiter for API integrations. This library is specifically designed to wrap the `Do` method of the http.Client but since it uses an interface abstraction it can wrap any interface and limit requests.
Controls - Delay between requests - Number of retries per request - Concurrency limit for the client
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client defines an interface with a Do method for use with http.Client or other mocked instances that implement a do method that accept a request and return a response error combo
func New ¶
func New( ctx context.Context, client Client, delay time.Duration, retries int, concurrency int, requestTimeout time.Duration, ) Client
New creates a new instance of the bridgekeeper for use with an api. New returns an interface implementation of Client which replaces the implementation of an http.Client interface so that it looks like an http.Client and can perform the same functions but it limits the requests using the parameters defined when created. NOTE: If a request timeout is not set at creation then the default HTTP client request timeout will be used