Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balancer ¶
type Balancer interface {
// Balance will return an address for a service or an empty
// string if no nodes are available.
Balance(service string) (addr string, err merry.Error)
}
Balancer is a load balancer that wraps a service discovery instance to distribute access across the nodes of a service.
func NewLeastN ¶
NewLeastN returns a Balancer that returns the node with the least connections of `n` randomly chosen nodes
func NewRandom ¶
NewRandom returns a Balancer that randomly selects one of the current nodes supplied by its Resolver
func NewRoundRobin ¶
NewRoundRobin returns a Balancer that implements round robin load balancing
Click to show internal directories.
Click to hide internal directories.