Documentation ¶
Index ¶
Constants ¶
View Source
const ( //default check setting DefaultCheckMethod = 0 DefaultCheckTimeout = 5 DefaultCheckMaxErrNum = 2 DefaultCheckInterval = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsistentHashBanlance ¶
type ConsistentHashBanlance struct {
// contains filtered or unexported fields
}
func NewConsistentHashBanlance ¶
func NewConsistentHashBanlance(replicas int, fn Hash) *ConsistentHashBanlance
func (*ConsistentHashBanlance) Add ¶
func (c *ConsistentHashBanlance) Add(params ...string) error
Add 方法用来添加缓存节点,参数为节点key,比如使用IP
func (*ConsistentHashBanlance) Get ¶
func (c *ConsistentHashBanlance) Get(key string) (string, error)
Get 方法根据给定的对象获取最靠近它的那个节点
func (*ConsistentHashBanlance) SetConf ¶
func (c *ConsistentHashBanlance) SetConf(conf LoadBalanceConf)
func (*ConsistentHashBanlance) Update ¶
func (c *ConsistentHashBanlance) Update()
type LoadBalance ¶
func LoadBanlanceFactorWithConf ¶
func LoadBanlanceFactorWithConf(lbType LbType, mConf LoadBalanceConf) LoadBalance
func LoadBanlanceFactory ¶
func LoadBanlanceFactory(lbType LbType) LoadBalance
type LoadBalanceCheckConf ¶
type LoadBalanceCheckConf struct {
// contains filtered or unexported fields
}
func NewLoadBalanceCheckConf ¶
func NewLoadBalanceCheckConf(format string, conf map[string]string) (*LoadBalanceCheckConf, error)
func (*LoadBalanceCheckConf) Attach ¶
func (s *LoadBalanceCheckConf) Attach(o Observer)
func (*LoadBalanceCheckConf) GetConf ¶
func (s *LoadBalanceCheckConf) GetConf() []string
func (*LoadBalanceCheckConf) NotifyAllObservers ¶
func (s *LoadBalanceCheckConf) NotifyAllObservers()
func (*LoadBalanceCheckConf) UpdateConf ¶
func (s *LoadBalanceCheckConf) UpdateConf(conf []string)
更新配置时,通知监听者也更新
type LoadBalanceConf ¶
type LoadBalanceConf interface { Attach(o Observer) GetConf() []string WatchConf() UpdateConf(conf []string) }
配置主题
type RandomBalance ¶
type RandomBalance struct {
// contains filtered or unexported fields
}
func (*RandomBalance) Add ¶
func (r *RandomBalance) Add(params ...string) error
func (*RandomBalance) Next ¶
func (r *RandomBalance) Next() string
func (*RandomBalance) SetConf ¶
func (r *RandomBalance) SetConf(conf LoadBalanceConf)
func (*RandomBalance) Update ¶
func (r *RandomBalance) Update()
type RoundRobinBalance ¶
type RoundRobinBalance struct {
// contains filtered or unexported fields
}
func (*RoundRobinBalance) Add ¶
func (r *RoundRobinBalance) Add(params ...string) error
func (*RoundRobinBalance) Next ¶
func (r *RoundRobinBalance) Next() string
func (*RoundRobinBalance) SetConf ¶
func (r *RoundRobinBalance) SetConf(conf LoadBalanceConf)
func (*RoundRobinBalance) Update ¶
func (r *RoundRobinBalance) Update()
type UInt32Slice ¶
type UInt32Slice []uint32
func (UInt32Slice) Len ¶
func (s UInt32Slice) Len() int
func (UInt32Slice) Less ¶
func (s UInt32Slice) Less(i, j int) bool
func (UInt32Slice) Swap ¶
func (s UInt32Slice) Swap(i, j int)
type WeightNode ¶
type WeightNode struct {
// contains filtered or unexported fields
}
type WeightRoundRobinBalance ¶
type WeightRoundRobinBalance struct {
// contains filtered or unexported fields
}
func (*WeightRoundRobinBalance) Add ¶
func (r *WeightRoundRobinBalance) Add(params ...string) error
func (*WeightRoundRobinBalance) Get ¶
func (r *WeightRoundRobinBalance) Get(key string) (string, error)
func (*WeightRoundRobinBalance) Next ¶
func (r *WeightRoundRobinBalance) Next() string
func (*WeightRoundRobinBalance) SetConf ¶
func (r *WeightRoundRobinBalance) SetConf(conf LoadBalanceConf)
func (*WeightRoundRobinBalance) Update ¶
func (r *WeightRoundRobinBalance) Update()
Click to show internal directories.
Click to hide internal directories.