Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptiveLoadBalancer ¶
type AdaptiveLoadBalancer struct {
// contains filtered or unexported fields
}
func NewAdaptiveLoadBalancer ¶
func NewAdaptiveLoadBalancer() *AdaptiveLoadBalancer
func (*AdaptiveLoadBalancer) NextServer ¶
func (alb *AdaptiveLoadBalancer) NextServer(pool ServerPool, r *http.Request) *Server
func (*AdaptiveLoadBalancer) RecordMetrics ¶
func (alb *AdaptiveLoadBalancer) RecordMetrics(algorithm string, responseTime time.Duration, isError bool)
type Algorithm ¶
type Algorithm interface {
NextServer(pool ServerPool, r *http.Request) *Server
Name() string
}
func CreateAlgorithm ¶
type AlgorithmStats ¶
type BoundedLeastConnections ¶
type BoundedLeastConnections struct {
// contains filtered or unexported fields
}
func NewBoundedLeastConnections ¶
func NewBoundedLeastConnections(sampleSize int) *BoundedLeastConnections
func (*BoundedLeastConnections) Name ¶
func (blc *BoundedLeastConnections) Name() string
func (*BoundedLeastConnections) NextServer ¶
func (blc *BoundedLeastConnections) NextServer(pool ServerPool, _ *http.Request) *Server
type IPHash ¶
type IPHash struct{}
func (*IPHash) NextServer ¶
func (ih *IPHash) NextServer(pool ServerPool, r *http.Request) *Server
type LeastConnections ¶
type LeastConnections struct{}
func (*LeastConnections) Name ¶
func (lc *LeastConnections) Name() string
func (*LeastConnections) NextServer ¶
func (lc *LeastConnections) NextServer(pool ServerPool, _ *http.Request) *Server
type LeastResponseTime ¶
type LeastResponseTime struct {
// contains filtered or unexported fields
}
func NewLeastResponseTime ¶
func NewLeastResponseTime() *LeastResponseTime
func (*LeastResponseTime) Name ¶
func (lrt *LeastResponseTime) Name() string
func (*LeastResponseTime) NextServer ¶
func (lrt *LeastResponseTime) NextServer(pool ServerPool, _ *http.Request) *Server
func (*LeastResponseTime) UpdateResponseTime ¶
func (lrt *LeastResponseTime) UpdateResponseTime(serverURL string, duration time.Duration)
type RoundRobin ¶
type RoundRobin struct{}
func (*RoundRobin) Name ¶
func (rr *RoundRobin) Name() string
func (*RoundRobin) NextServer ¶
func (rr *RoundRobin) NextServer(pool ServerPool, _ *http.Request) *Server
type Server ¶
type Server struct {
URL string
Weight int
CurrentWeight int
ConnectionCount int32
MaxConnections int32
Alive bool
LastResponseTime time.Duration
}
func (*Server) CanAcceptConnection ¶
type ServerPool ¶
type WeightedRoundRobin ¶
type WeightedRoundRobin struct {
// contains filtered or unexported fields
}
func (*WeightedRoundRobin) Name ¶
func (wrr *WeightedRoundRobin) Name() string
func (*WeightedRoundRobin) NextServer ¶
func (wrr *WeightedRoundRobin) NextServer(pool ServerPool, _ *http.Request) *Server
Click to show internal directories.
Click to hide internal directories.