Documentation ¶
Overview ¶
Package lb provides a flexible load balancer with pluggable strategies.
Index ¶
Constants ¶
View Source
const ( // Random algorithm Random = "random" // RoundRobin algorithm RoundRobin = "round-robin" // WeightedRoundRobin algorithm WeightedRoundRobin = "weighted-round-robin" // ConsistentHash algorithm ConsistentHash = "consistent-hash" // WeightedRandom algorithm WeightedRandom = "weighted-random" // VersioningWRR algorithm VersioningWRR = "versioning-wrr" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
New make a new instance of a balancer.
l := lb.New(lb.WeightedRoundRobin, lb.WithPeers(some-peers-here...)) fmt.Println(l.Next(lbapi.DummyFactor)
check out the real example in test codes.
func Unregister ¶
func Unregister(algorithm string)
Unregister revoke a (algorithm, generator) pair.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.