Documentation ¶
Index ¶
- Constants
- type DefaultBalance
- type 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
- type NodeBalanceSlice
Constants ¶
View Source
const ( RoundRobinByWeight = 1 SelectByIPHash = 2 SelectByRand = 3 RoundRobin = 4 SelectByWeightRand = 5 Ready = "ok" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultBalance ¶
func (*DefaultBalance) GetCWeight ¶
func (this *DefaultBalance) GetCWeight() int
func (*DefaultBalance) GetId ¶
func (this *DefaultBalance) GetId() string
func (*DefaultBalance) GetStatus ¶
func (this *DefaultBalance) GetStatus() string
func (*DefaultBalance) GetWeight ¶
func (this *DefaultBalance) GetWeight() int
func (*DefaultBalance) SetCWeight ¶
func (this *DefaultBalance) SetCWeight(val int)
func (*DefaultBalance) SetWeight ¶
func (this *DefaultBalance) SetWeight(Weight int)
type LoadBalance ¶
type LoadBalance struct {
// contains filtered or unexported fields
}
func New ¶
func New() *LoadBalance
func (*LoadBalance) AddNode ¶
func (this *LoadBalance) AddNode(nodeSlice ...NodeBalance)
func (*LoadBalance) Clear ¶
func (this *LoadBalance) Clear()
func (*LoadBalance) NeedReLoad ¶
func (this *LoadBalance) NeedReLoad(service NodeBalanceSlice) bool
func (*LoadBalance) RoundRobin ¶
func (this *LoadBalance) RoundRobin() (NodeBalance, error)
func (*LoadBalance) RoundRobinByWeight ¶
func (this *LoadBalance) RoundRobinByWeight() (NodeBalance, error)
平滑加权轮询
func (*LoadBalance) SelectByIPHash ¶
func (this *LoadBalance) SelectByIPHash(ip string) (NodeBalance, error)
func (*LoadBalance) SelectByRand ¶
func (this *LoadBalance) SelectByRand() (NodeBalance, error)
func (*LoadBalance) SelectByWeightRand ¶
func (this *LoadBalance) SelectByWeightRand() (NodeBalance, error)
type NodeBalance ¶
type NodeBalanceSlice ¶
type NodeBalanceSlice []NodeBalance
func (NodeBalanceSlice) Len ¶
func (p NodeBalanceSlice) Len() int
func (NodeBalanceSlice) Less ¶
func (p NodeBalanceSlice) Less(i, j int) bool
func (NodeBalanceSlice) Swap ¶
func (p NodeBalanceSlice) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.