route

package
v0.0.0-...-96ff825 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNMODIFIED = PoolPutResult(iota)
	UPDATED
	ADDED
)

Variables

This section is empty.

Functions

func PoolsMatch

func PoolsMatch(p1, p2 *EndpointPool) bool

Types

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter(initial int64) *Counter

func (*Counter) Count

func (c *Counter) Count() int64

func (*Counter) Decrement

func (c *Counter) Decrement()

func (*Counter) Increment

func (c *Counter) Increment()

type Endpoint

type Endpoint struct {
	ApplicationId    string
	AvailabilityZone string

	Protocol             string
	Tags                 map[string]string
	ServerCertDomainSAN  string
	PrivateInstanceId    string
	StaleThreshold       time.Duration
	RouteServiceUrl      string
	PrivateInstanceIndex string
	ModificationTag      models.ModificationTag
	Stats                *Stats
	IsolationSegment     string

	UpdatedAt        time.Time
	RoundTripperInit sync.Once
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(opts *EndpointOpts) *Endpoint

func (*Endpoint) CanonicalAddr

func (e *Endpoint) CanonicalAddr() string

func (*Endpoint) Component

func (e *Endpoint) Component() string

func (*Endpoint) Equal

func (e *Endpoint) Equal(e2 *Endpoint) bool

func (*Endpoint) IsTLS

func (e *Endpoint) IsTLS() bool

func (*Endpoint) MarshalJSON

func (e *Endpoint) MarshalJSON() ([]byte, error)

func (*Endpoint) RoundTripper

func (e *Endpoint) RoundTripper() ProxyRoundTripper

func (*Endpoint) SetRoundTripper

func (e *Endpoint) SetRoundTripper(tripper ProxyRoundTripper)

func (*Endpoint) SetRoundTripperIfNil

func (e *Endpoint) SetRoundTripperIfNil(roundTripperCtor func() ProxyRoundTripper)

func (*Endpoint) ToLogData

func (e *Endpoint) ToLogData() []zap.Field

type EndpointIterator

type EndpointIterator interface {
	// Next MUST either return the next endpoint available or nil. It MUST NOT return the same endpoint.
	// All available endpoints MUST have been used before any can be used again.
	// ProxyRoundTripper will not retry more often than endpoints available.
	Next(attempt int) *Endpoint
	EndpointFailed(err error)
	PreRequest(e *Endpoint)
	PostRequest(e *Endpoint)
}

func NewLeastConnection

func NewLeastConnection(logger logger.Logger, p *EndpointPool, initial string, mustBeSticky bool, locallyOptimistic bool, localAvailabilityZone string) EndpointIterator

func NewRoundRobin

func NewRoundRobin(logger logger.Logger, p *EndpointPool, initial string, mustBeSticky bool, locallyOptimistic bool, localAvailabilityZone string) EndpointIterator

type EndpointOpts

type EndpointOpts struct {
	AppId                   string
	AvailabilityZone        string
	Host                    string
	Port                    uint16
	Protocol                string
	ServerCertDomainSAN     string
	PrivateInstanceId       string
	PrivateInstanceIndex    string
	Tags                    map[string]string
	StaleThresholdInSeconds int
	RouteServiceUrl         string
	ModificationTag         models.ModificationTag
	IsolationSegment        string
	UseTLS                  bool
	UpdatedAt               time.Time
}

type EndpointPool

type EndpointPool struct {
	sync.Mutex

	RouteSvcUrl string

	NextIdx int
	// contains filtered or unexported fields
}

func NewPool

func NewPool(opts *PoolOpts) *EndpointPool

func (*EndpointPool) ContextPath

func (p *EndpointPool) ContextPath() string

func (*EndpointPool) Each

func (p *EndpointPool) Each(f func(endpoint *Endpoint))

func (*EndpointPool) EndpointFailed

func (p *EndpointPool) EndpointFailed(endpoint *Endpoint, err error)

func (*EndpointPool) Endpoints

func (p *EndpointPool) Endpoints(logger logger.Logger, defaultLoadBalance string, initial string, mustBeSticky bool, azPreference string, az string) EndpointIterator

func (*EndpointPool) Host

func (p *EndpointPool) Host() string

func (*EndpointPool) IsEmpty

func (p *EndpointPool) IsEmpty() bool

func (*EndpointPool) IsOverloaded

func (p *EndpointPool) IsOverloaded() bool

func (*EndpointPool) LastUpdated

func (p *EndpointPool) LastUpdated() time.Time

func (*EndpointPool) MarkUpdated

func (p *EndpointPool) MarkUpdated(t time.Time)

func (*EndpointPool) MarshalJSON

func (p *EndpointPool) MarshalJSON() ([]byte, error)

func (*EndpointPool) MaxConnsPerBackend

func (p *EndpointPool) MaxConnsPerBackend() int64

func (*EndpointPool) NumEndpoints

func (p *EndpointPool) NumEndpoints() int

func (*EndpointPool) PruneEndpoints

func (p *EndpointPool) PruneEndpoints() []*Endpoint

func (*EndpointPool) Put

func (p *EndpointPool) Put(endpoint *Endpoint) PoolPutResult

func (*EndpointPool) Remove

func (p *EndpointPool) Remove(endpoint *Endpoint) bool

Returns true if the endpoint was removed from the EndpointPool, false otherwise.

func (*EndpointPool) RouteServiceUrl

func (p *EndpointPool) RouteServiceUrl() string

func (*EndpointPool) Update

func (p *EndpointPool) Update()

type LeastConnection

type LeastConnection struct {
	// contains filtered or unexported fields
}

func (*LeastConnection) EndpointFailed

func (r *LeastConnection) EndpointFailed(err error)

func (*LeastConnection) Next

func (r *LeastConnection) Next(attempt int) *Endpoint

func (*LeastConnection) PostRequest

func (r *LeastConnection) PostRequest(e *Endpoint)

func (*LeastConnection) PreRequest

func (r *LeastConnection) PreRequest(e *Endpoint)

type PoolOpts

type PoolOpts struct {
	RetryAfterFailure  time.Duration
	Host               string
	ContextPath        string
	MaxConnsPerBackend int64
	Logger             logger.Logger
}

type PoolPutResult

type PoolPutResult int

type ProxyRoundTripper

type ProxyRoundTripper interface {
	http.RoundTripper
	CancelRequest(*http.Request)
}

type RoundRobin

type RoundRobin struct {
	// contains filtered or unexported fields
}

func (*RoundRobin) EndpointFailed

func (r *RoundRobin) EndpointFailed(err error)

func (*RoundRobin) Next

func (r *RoundRobin) Next(attempt int) *Endpoint

func (*RoundRobin) PostRequest

func (r *RoundRobin) PostRequest(e *Endpoint)

func (*RoundRobin) PreRequest

func (r *RoundRobin) PreRequest(e *Endpoint)

type Stats

type Stats struct {
	NumberConnections *Counter
}

func NewStats

func NewStats() *Stats

type Uri

type Uri string

func (Uri) NextWildcard

func (u Uri) NextWildcard() (Uri, error)

func (Uri) RouteKey

func (u Uri) RouteKey() Uri

func (Uri) String

func (u Uri) String() string

func (Uri) ToLower

func (u Uri) ToLower() Uri

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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