Versions in this module Expand all Collapse all v0 v0.1.1 Oct 25, 2022 Changes in this version + const BoundedBalancer + const ConsistentHashBalancer + const IPHashBalancer + const LeastLoadBalancer + const P2CBalancer + const R2Balancer + const RandomBalancer + const Salt + var AlgorithmNotSupportedError = errors.New("algorithm not supported") + var NoHostError = errors.New("no host") + type Balancer interface + Add func(string) + Balance func(string) (string, error) + Done func(string) + Inc func(string) + Remove func(string) + func Build(algorithm string, hosts []string) (Balancer, error) + func NewBounded(hosts []string) Balancer + func NewConsistent(hosts []string) Balancer + func NewIPHash(hosts []string) Balancer + func NewLeastLoad(hosts []string) Balancer + func NewP2C(hosts []string) Balancer + func NewRandom(hosts []string) Balancer + func NewRoundRobin(hosts []string) Balancer + type Bounded struct + func (b *Bounded) Add(host string) + func (b *Bounded) Balance(key string) (string, error) + func (b *Bounded) Done(host string) + func (b *Bounded) Inc(host string) + func (b *Bounded) Remove(host string) + type Consistent struct + func (c *Consistent) Add(host string) + func (c *Consistent) Balance(key string) (string, error) + func (c *Consistent) Done(_ string) + func (c *Consistent) Inc(_ string) + func (c *Consistent) Remove(host string) + type Factory func([]string) Balancer + type IPHash struct + func (r *IPHash) Add(host string) + func (r *IPHash) Balance(key string) (string, error) + func (r *IPHash) Done(_ string) + func (r *IPHash) Inc(_ string) + func (r *IPHash) Remove(host string) + type LeastLoad struct + func (l *LeastLoad) Add(hostName string) + func (l *LeastLoad) Balance(_ string) (string, error) + func (l *LeastLoad) Done(hostName string) + func (l *LeastLoad) Inc(hostName string) + func (l *LeastLoad) Remove(hostName string) + func (l *LeastLoad) Value(hostName string) uint64 + type P2C struct + func (p *P2C) Add(hostName string) + func (p *P2C) Balance(key string) (string, error) + func (p *P2C) Done(host string) + func (p *P2C) Inc(host string) + func (p *P2C) Remove(host string) + type Random struct + func (r *Random) Add(host string) + func (r *Random) Balance(_ string) (string, error) + func (r *Random) Done(_ string) + func (r *Random) Inc(_ string) + func (r *Random) Remove(host string) + type RoundRobin struct + func (r *RoundRobin) Add(host string) + func (r *RoundRobin) Balance(_ string) (string, error) + func (r *RoundRobin) Done(_ string) + func (r *RoundRobin) Inc(_ string) + func (r *RoundRobin) Remove(host string)