Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoadBalancer ¶
type LoadBalancer interface { // load balancer will need internal map(array) of ids to counts DecConn(id uint16) error IncConn(id uint16) error // proxy will call this to determine where to route request GetDownstream() uint16 MarkHealthy(id uint16) MarkUnhealthy(id uint16) }
LoadBalancer interface defines the functions the load balancer needs to implement
type PowerOfTwoLoadBalancer ¶
type PowerOfTwoLoadBalancer struct {
// contains filtered or unexported fields
}
PowerOfTwoLoadBalancer implementation
func NewPowerOfTwoLoadBalancer ¶
func NewPowerOfTwoLoadBalancer(n uint16) *PowerOfTwoLoadBalancer
NewPowerOfTwoLoadBalancer makes a PowerOfTwoLoadBalancer and returns it
func (*PowerOfTwoLoadBalancer) DecConn ¶
func (lb *PowerOfTwoLoadBalancer) DecConn(id uint16) error
DecConn decrements the number of connections of a particular downstream
func (*PowerOfTwoLoadBalancer) GetDownstream ¶
func (lb *PowerOfTwoLoadBalancer) GetDownstream() uint16
GetDownstream uses the power of two algorithm to determine which connection to forward request to, returns the id
func (*PowerOfTwoLoadBalancer) IncConn ¶
func (lb *PowerOfTwoLoadBalancer) IncConn(id uint16) error
IncConn increments the number of connections of a particular downstream
func (*PowerOfTwoLoadBalancer) MarkHealthy ¶
func (lb *PowerOfTwoLoadBalancer) MarkHealthy(id uint16)
MarkHealthy allows health monitor to tell LB when a downstream id becomes healthy
func (*PowerOfTwoLoadBalancer) MarkUnhealthy ¶
func (lb *PowerOfTwoLoadBalancer) MarkUnhealthy(id uint16)
MarkUnhealthy allows health monitor to tell LB when a downstream id becomes unhealthy
Click to show internal directories.
Click to hide internal directories.