http

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ChromaGoClientUserAgent = "chroma-go-client/0.1.x"

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*SimpleRetryStrategy) error

func WithExponentialBackOff

func WithExponentialBackOff() Option

func WithFixedDelay

func WithFixedDelay(delay time.Duration) Option

func WithMaxRetries

func WithMaxRetries(retries int) Option

func WithRetryableStatusCodes

func WithRetryableStatusCodes(statusCodes ...int) Option

type RetryStrategy

type RetryStrategy interface {
	DoWithRetry(client *http.Client, req *http.Request) (*http.Response, error)
}

type SimpleRetryStrategy

type SimpleRetryStrategy struct {
	MaxRetries           int
	FixedDelay           time.Duration
	ExponentialBackOff   bool
	RetryableStatusCodes []int
}

func NewSimpleRetryStrategy

func NewSimpleRetryStrategy(opts ...Option) (*SimpleRetryStrategy, error)

func (*SimpleRetryStrategy) DoWithRetry

func (r *SimpleRetryStrategy) DoWithRetry(client *http.Client, req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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