Versions in this module Expand all Collapse all v1 v1.0.12 Mar 1, 2021 Changes in this version + const Ready + const RoundRobin + const RoundRobinByWeight + const SelectByIPHash + const SelectByRand + const SelectByWeightRand + type DefaultBalance struct + CWeight int + Id string + Status string + Weight int + func (this *DefaultBalance) GetCWeight() int + func (this *DefaultBalance) GetId() string + func (this *DefaultBalance) GetStatus() string + func (this *DefaultBalance) GetWeight() int + func (this *DefaultBalance) SetCWeight(val int) + func (this *DefaultBalance) SetWeight(Weight int) + type LoadBalance struct + func New() *LoadBalance + func (this *LoadBalance) AddNode(nodeSlice ...NodeBalance) + func (this *LoadBalance) Clear() + func (this *LoadBalance) NeedReLoad(service NodeBalanceSlice) bool + func (this *LoadBalance) RoundRobin() (NodeBalance, error) + func (this *LoadBalance) RoundRobinByWeight() (NodeBalance, error) + func (this *LoadBalance) SelectByIPHash(ip string) (NodeBalance, error) + func (this *LoadBalance) SelectByRand() (NodeBalance, error) + func (this *LoadBalance) SelectByWeightRand() (NodeBalance, error) + type NodeBalance interface + GetCWeight func() int + GetId func() string + GetNode func() interface{} + GetStatus func() string + GetWeight func() int + SetCWeight func(val int) + SetWeight func(Weight int) + type NodeBalanceSlice []NodeBalance + func (p NodeBalanceSlice) Len() int + func (p NodeBalanceSlice) Less(i, j int) bool + func (p NodeBalanceSlice) Swap(i, j int)