Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer returns endpoints for downstream calls
func New ¶
func New(strategy Strategy, endPoints []url.URL) *LoadBalancer
New creates a new loadbalancer and setting the given strategy
func (*LoadBalancer) GetEndpoint ¶
func (l *LoadBalancer) GetEndpoint() url.URL
GetEndpoint gets an endpoint based on the given strategy
func (*LoadBalancer) UpdateEndpoints ¶
func (l *LoadBalancer) UpdateEndpoints(urls []url.URL)
UpdateEndpoints updates the endpoints available to the strategy
type RandomStrategy ¶
type RandomStrategy struct {
// contains filtered or unexported fields
}
RandomStrategy implements Strategy for random endpoint selection
func (*RandomStrategy) NextEndpoint ¶
func (rs *RandomStrategy) NextEndpoint() url.URL
NextEndpoint returns an endpoint using the random strategy
func (*RandomStrategy) SetEndpoints ¶
func (rs *RandomStrategy) SetEndpoints(endpoints []url.URL)
SetEndpoints sets the available endpoints for use by the strategy
type RoundRobinStrategy ¶
type RoundRobinStrategy struct {
// contains filtered or unexported fields
}
RoundRobinStrategy implements Strategy for round robin endpoint selection
func (*RoundRobinStrategy) NextEndpoint ¶
func (rrs *RoundRobinStrategy) NextEndpoint() url.URL
NextEndpoint returns an endpoint using the round robin strategy
func (*RoundRobinStrategy) SetEndpoints ¶
func (rrs *RoundRobinStrategy) SetEndpoints(endpoints []url.URL)
SetEndpoints sets the available endpoints for use by the strategy