armbalancer

package module
v0.0.0-...-bc1f8ed Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, opts Options) http.RoundTripper

New wraps a transport to provide smart connection pooling and client-side load balancing.

func NewHostScopedTransport

func NewHostScopedTransport(ctx context.Context, transportFactory func() *transportChannPool) *hostScopedTransport

Types

type ClosableTransport

type ClosableTransport struct {
	*http.Transport
}

func (*ClosableTransport) ForceClose

func (transport *ClosableTransport) ForceClose() error

func (*ClosableTransport) RoundTrip

func (transport *ClosableTransport) RoundTrip(req *http.Request) (*http.Response, error)

type KillBeforeThrottledPolicy

type KillBeforeThrottledPolicy struct {
	RecycleThreshold int64
}

func (*KillBeforeThrottledPolicy) ShouldDropTransport

func (policy *KillBeforeThrottledPolicy) ShouldDropTransport(header http.Header) bool

type Options

type Options struct {
	Transport *http.Transport

	// PoolSize is the max number of connections that will be created by the connection pool.
	// Default: 8
	PoolSize int

	// RecycleThreshold is the lowest value of any X-Ms-Ratelimit-Remaining-* header that
	// can be seen before the associated connection will be re-established.
	// Default: 100
	RecycleThreshold int64

	// MinReqsBeforeRecycle is a safeguard to prevent frequent connection churn in the unlikely event
	// that a connections lands on an ARM instance that already has a depleted rate limiting quota.
	// Default: 10
	MinReqsBeforeRecycle int64
}

type Transport

type Transport interface {
	http.RoundTripper
	ForceClose() error
}

type TransportDropPolicy

type TransportDropPolicy interface {
	ShouldDropTransport(header http.Header) bool
}

type TransportDropPolicyFunc

type TransportDropPolicyFunc func(header http.Header) bool

func (TransportDropPolicyFunc) ShouldDropTransport

func (function TransportDropPolicyFunc) ShouldDropTransport(header http.Header) bool

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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