Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashingBalancer ¶
type HashingBalancer struct {
// contains filtered or unexported fields
}
HashingBalancer implements a consistent hashing balancer with virtual nodes.
func NewBalancer ¶
func NewBalancer(proxies []proxy.Proxy, hashon string) *HashingBalancer
NewBalancer creates a new HashingBalancer instance. It initializes the hash ring with virtual nodes for each proxy.
func (*HashingBalancer) Proxies ¶
func (b *HashingBalancer) Proxies() []proxy.Proxy
Proxies returns the list of proxies managed by the balancer.
func (*HashingBalancer) Select ¶
func (b *HashingBalancer) Select(ctx context.Context, c *app.RequestContext) (proxy.Proxy, error)
Select picks a proxy from the hash ring based on a hashed value from the request. If the selected proxy is unavailable, it moves clockwise along the ring to find the next available one.
Click to show internal directories.
Click to hide internal directories.