Documentation ¶
Index ¶
- Constants
- func PoolsMatch(p1, p2 *EndpointPool) bool
- type Counter
- type Endpoint
- func (e *Endpoint) CanonicalAddr() string
- func (e *Endpoint) Component() string
- func (e *Endpoint) Equal(e2 *Endpoint) bool
- func (e *Endpoint) IsTLS() bool
- func (e *Endpoint) MarshalJSON() ([]byte, error)
- func (e *Endpoint) RoundTripper() ProxyRoundTripper
- func (e *Endpoint) SetRoundTripper(tripper ProxyRoundTripper)
- func (e *Endpoint) SetRoundTripperIfNil(roundTripperCtor func() ProxyRoundTripper)
- func (e *Endpoint) ToLogData() []zap.Field
- type EndpointIterator
- type EndpointOpts
- type EndpointPool
- func (p *EndpointPool) ContextPath() string
- func (p *EndpointPool) Each(f func(endpoint *Endpoint))
- func (p *EndpointPool) EndpointFailed(endpoint *Endpoint, err error)
- func (p *EndpointPool) Endpoints(logger logger.Logger, defaultLoadBalance string, initial string, ...) EndpointIterator
- func (p *EndpointPool) Host() string
- func (p *EndpointPool) IsEmpty() bool
- func (p *EndpointPool) IsOverloaded() bool
- func (p *EndpointPool) LastUpdated() time.Time
- func (p *EndpointPool) MarkUpdated(t time.Time)
- func (p *EndpointPool) MarshalJSON() ([]byte, error)
- func (p *EndpointPool) MaxConnsPerBackend() int64
- func (p *EndpointPool) NumEndpoints() int
- func (p *EndpointPool) PruneEndpoints() []*Endpoint
- func (p *EndpointPool) Put(endpoint *Endpoint) PoolPutResult
- func (p *EndpointPool) Remove(endpoint *Endpoint) bool
- func (p *EndpointPool) RouteServiceUrl() string
- func (p *EndpointPool) Update()
- type LeastConnection
- type PoolOpts
- type PoolPutResult
- type ProxyRoundTripper
- type RoundRobin
- type Stats
- type Uri
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 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 (*Endpoint) MarshalJSON ¶
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)
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 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)
Click to show internal directories.
Click to hide internal directories.