Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoEndpoints = errors.New("no endpoints available")
ErrNoEndpoints is returned by a strategy when there are no endpoints available.
var ErrNoEndpointsAvailable = errors.New("no endpoints available")
ErrNoEndpointsAvailable is given by a load balancer when no endpoints are available to be returned.
Functions ¶
Types ¶
type LoadBalancer ¶
LoadBalancer yields endpoints one-by-one.
func Random ¶
func Random(p Publisher) LoadBalancer
Random returns a load balancer that yields random endpoints.
func RoundRobin ¶
func RoundRobin(p Publisher) LoadBalancer
RoundRobin returns a load balancer that yields endpoints in sequence.
type Publisher ¶
type Publisher interface { Subscribe(chan<- []endpoint.Endpoint) Unsubscribe(chan<- []endpoint.Endpoint) Stop() }
Publisher produces endpoints.
type StaticPublisher ¶
type StaticPublisher struct {
// contains filtered or unexported fields
}
StaticPublisher holds a static set of endpoints.
func NewStaticPublisher ¶
func NewStaticPublisher(endpoints []endpoint.Endpoint) *StaticPublisher
NewStaticPublisher returns a publisher that yields a static set of endpoints, which can be completely replaced.
func (*StaticPublisher) Replace ¶
func (p *StaticPublisher) Replace(endpoints []endpoint.Endpoint)
Replace replaces the endpoints and notifies all subscribers.
func (*StaticPublisher) Stop ¶
func (p *StaticPublisher) Stop()
Stop implements Publisher, but is a no-op.
func (*StaticPublisher) Subscribe ¶
func (p *StaticPublisher) Subscribe(c chan<- []endpoint.Endpoint)
Subscribe implements Publisher.
func (*StaticPublisher) Unsubscribe ¶
func (p *StaticPublisher) Unsubscribe(c chan<- []endpoint.Endpoint)
Unsubscribe implements Publisher.