Documentation ¶
Overview ¶
Package balancer provides a simple interface to create concrete balancer algorightms that can be used to choose an upstream
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyBackendList is used when the list of beckends is empty ErrEmptyBackendList = errors.New("can not elect backend, Backends empty") // ErrCannotElectBackend is used a backend cannot be elected ErrCannotElectBackend = errors.New("cant elect backend") // ErrUnsupportedAlgorithm is used when an unsupported algorithm is given ErrUnsupportedAlgorithm = errors.New("unsupported balancing algorithm") )
View Source
var ( // ErrZeroWeight is used when there a zero value weight was given ErrZeroWeight = errors.New("invalid backend, weight 0 given") )
Functions ¶
This section is empty.
Types ¶
type RoundrobinBalancer ¶
type RoundrobinBalancer struct {
// contains filtered or unexported fields
}
RoundrobinBalancer balancer
func NewRoundrobinBalancer ¶
func NewRoundrobinBalancer() *RoundrobinBalancer
NewRoundrobinBalancer creates a new instance of Roundrobin
type Target ¶
Target is an ip address/hostname with a port that identifies an instance of a backend service
type WeightBalancer ¶
type WeightBalancer struct{}
WeightBalancer balancer
func NewWeightBalancer ¶
func NewWeightBalancer() *WeightBalancer
NewWeightBalancer creates a new instance of WeightBalancer
Click to show internal directories.
Click to hide internal directories.