Documentation ¶
Overview ¶
package balancer provides reference implementations for common load balancing techniques across service sets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoServices = errors.New("balancer: no services found")
Functions ¶
This section is empty.
Types ¶
type LoadBalancer ¶
type LoadBalancer interface {
Next() (*discoverd.Service, error)
}
func Random ¶
func Random(set discoverd.ServiceSet, source rand.Source) LoadBalancer
Random returns a LoadBalancer that selects random services using a rand.Rand with source as the source. If source is nil, the default will be used.
func RoundRobin ¶
func RoundRobin(set discoverd.ServiceSet) LoadBalancer
RoundRobin returns a LoadBalancer that selects services in the order they appear in the service set.
Click to show internal directories.
Click to hide internal directories.