# README
Client
The mt-sre/client
package provides an opinionated HTTP client with
optional transport wrappers to facilitate writing reliable clients.
Development
Local testing
Tests can be run locally with the following command:
./pr_check.sh
License
See LICENSE for more information.
# Functions
ConstantBackoffGenerator returns a backoff with constant intervals between retries as set with the parameter 'd'.
ExponentialBackoffGenerator returns an ExponentialBackoff instance.
NewClient returns an opionanted HTTP client which can be optionally augmented with TransportWrappers which add features such as retries with exponential backoff.
NewDefaultRetryPolicy returns the default retry policy implementation.
NewOAUTHWrapper returns a TransportWrapper which adds OAUTH2 authentication to a HTTP transport.
NewRetryWrapper returns a TransportWrapper which detects whether a HTTP request should be retried given a particular failure scenario.
NoBackoffGenerator returns a backoff which has no time interval between retries.
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WithLogger configures a RetryWrapper instance with the provided logr.Logger instance.
WithTransport configures a Client instance with the given http.RoundTripper instance.
WithWrapper configures a Client instance with the given TransportWrapper.
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
RetryPolicy configures a RetryWrapper's logic to determine when a HTTP request is retryable.
No description provided by the author
TransportWrapper adds functionality to a http.RoundTripper by adding pre and post call execution steps.
# Type aliases
BackoffGenerator always returns a new instance of backoff.Backoff to ensure a fresh backoff state for repeated reqeusts.
WithAccessToken configures a OAUTHWrapper with an OAUTH2 token used when making requests.
WithBackoffGenerator configures a RetryWrapper instance with the provided BackoffGenerator.
WithInitialInterval sets the wait time between the first and second request attempts.
WithMaxElapsedTime sets the maximum cumulative time after which retries are no longer performed.
WithMaxRetries sets the maximum retry attempts for a RetryWrapper instance.
WithMultiplier sets the exponential base used for increasing backoff.
WithRandomizationFactor sets the degree to which jitter is applied to successive retries.