Documentation ¶
Overview ¶
Package lb is default LoadBalance implements.
Index ¶
- Constants
- func NewWeightLbFunc(newLb motan.NewLbFunc) motan.NewLbFunc
- func RegistDefaultLb(extFactory motan.ExtentionFactory)
- func SelectArrayFromIndex(endpoints []motan.EndPoint, fromIndex int) []motan.EndPoint
- func SelectOneAtRandom(endpoints []motan.EndPoint) (int, motan.EndPoint)
- type RandomLB
- type RoundrobinLB
- type WeightedLbWraper
Constants ¶
View Source
const ( Random = "random" Roundrobin = "roundrobin" )
ext name
View Source
const (
MaxSelectArraySize = 3
)
Variables ¶
This section is empty.
Functions ¶
func RegistDefaultLb ¶
func RegistDefaultLb(extFactory motan.ExtentionFactory)
func SelectArrayFromIndex ¶
Types ¶
type RandomLB ¶
type RandomLB struct {
// contains filtered or unexported fields
}
func (*RandomLB) SelectArray ¶
type RoundrobinLB ¶
type RoundrobinLB struct {
// contains filtered or unexported fields
}
func (*RoundrobinLB) OnRefresh ¶
func (r *RoundrobinLB) OnRefresh(endpoints []motan.EndPoint)
func (*RoundrobinLB) SelectArray ¶
func (r *RoundrobinLB) SelectArray(request motan.Request) []motan.EndPoint
func (*RoundrobinLB) SetWeight ¶
func (r *RoundrobinLB) SetWeight(weight string)
type WeightedLbWraper ¶
type WeightedLbWraper struct {
// contains filtered or unexported fields
}
WeightedLbWraper support multi group weighted LB
func (*WeightedLbWraper) OnRefresh ¶
func (w *WeightedLbWraper) OnRefresh(endpoints []motan.EndPoint)
func (*WeightedLbWraper) Select ¶
func (w *WeightedLbWraper) Select(request motan.Request) motan.EndPoint
func (*WeightedLbWraper) SelectArray ¶
func (w *WeightedLbWraper) SelectArray(request motan.Request) []motan.EndPoint
func (*WeightedLbWraper) SetWeight ¶
func (w *WeightedLbWraper) SetWeight(weight string)
Click to show internal directories.
Click to hide internal directories.