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, w *http.ResponseWriter) *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, w *http.ResponseWriter) *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, w http.ResponseWriter) *Server
type IPHash ¶
type IPHash struct{}
func (*IPHash) NextServer ¶
func (ih *IPHash) NextServer(pool ServerPool, r *http.Request, w *http.ResponseWriter) *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, w *http.ResponseWriter) *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, w *http.ResponseWriter, ) *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, w *http.ResponseWriter) *Server
type Server ¶
type Server struct {
URL string
Weight int
CurrentWeight atomic.Int32
ConnectionCount int32
MaxConnections int32
Alive atomic.Bool
LastResponseTime time.Duration
}
func (*Server) CanAcceptConnection ¶
type ServerPool ¶
type StickySession ¶ added in v0.4.3
type StickySession struct {
// contains filtered or unexported fields
}
func NewStickySession ¶ added in v0.4.3
func NewStickySession() *StickySession
func (*StickySession) Name ¶ added in v0.4.3
func (ss *StickySession) Name() string
func (*StickySession) NextServer ¶ added in v0.4.3
func (ss *StickySession) NextServer(pool ServerPool, r *http.Request, w *http.ResponseWriter) *Server
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, w *http.ResponseWriter) *Server
Click to show internal directories.
Click to hide internal directories.