route

package
v0.0.0-...-c13e492 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 14 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

	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 (rm *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() *Endpoint
	EndpointFailed(err error)
	PreRequest(e *Endpoint)
	PostRequest(e *Endpoint)
}

func NewLeastConnection

func NewLeastConnection(p *EndpointPool, initial string) EndpointIterator

func NewRoundRobin

func NewRoundRobin(p *EndpointPool, initial string) EndpointIterator

type EndpointOpts

type EndpointOpts struct {
	AppId                   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
	// 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(defaultLoadBalance, initial 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() *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() *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