Versions in this module Expand all Collapse all v1 v1.0.0 Oct 29, 2021 Changes in this version + const DefaultCheckInterval + const DefaultCheckMaxErrNum + const DefaultCheckTimeout + var CheckConfigHandlerMap map[string]CheckConfigHandler + var LoadBalanceStrategyHandlerMap map[string]LoadBalanceStrategyHandler + func RegisterCheckConfigHandler(lbtype string, conf CheckConfigHandler) + func RegisterLoadBalanceStrategyHandler(name string, handler LoadBalanceStrategyHandler) + type CheckConfigHandler func(service *model.ServiceDetail) (LoadBalanceConf, error) + func GetCheckConfigHandler(lbtype string) CheckConfigHandler + type ConsistentHashStrategy struct + func NewConsistentHashStrategy(replicas int, fn Hash) *ConsistentHashStrategy + func (c *ConsistentHashStrategy) Add(params ...string) error + func (c *ConsistentHashStrategy) Get(key string) (string, error) + func (c *ConsistentHashStrategy) IsEmpty() bool + func (c *ConsistentHashStrategy) RemoveAll() error + func (r *ConsistentHashStrategy) GetAll() ([]string, error) + type Hash func(data []byte) uint32 + type LoadBalance struct + func LoadBanlanceFactorWithStrategy(strategy LoadBalanceStrategy, conf LoadBalanceConf) *LoadBalance + func NewLoadBalance(strategy LoadBalanceStrategy, conf LoadBalanceConf) *LoadBalance + func (r *LoadBalance) Add(params ...string) error + func (r *LoadBalance) Close() + func (r *LoadBalance) Get(params string) (string, error) + func (r *LoadBalance) GetAll() ([]string, error) + func (r *LoadBalance) Update() + type LoadBalanceCheckConf struct + func (s *LoadBalanceCheckConf) Attach(o Observer) + func (s *LoadBalanceCheckConf) CloseWatch() + func (s *LoadBalanceCheckConf) GetConf() []string + func (s *LoadBalanceCheckConf) NotifyAllObservers() + func (s *LoadBalanceCheckConf) UpdateConf(conf []string) + func (s *LoadBalanceCheckConf) WatchConf() + type LoadBalanceConf interface + Attach func(o Observer) + CloseWatch func() + GetConf func() []string + UpdateConf func(conf []string) + WatchConf func() + func NewLoadBalanceCheckConf(service *model.ServiceDetail) (LoadBalanceConf, error) + type LoadBalanceStrategy interface + Add func(...string) error + Get func(string) (string, error) + GetAll func() ([]string, error) + RemoveAll func() error + func GetLoadBalanceStrategy(name string) LoadBalanceStrategy + type LoadBalanceStrategyHandler func() LoadBalanceStrategy + type Observer interface + Update func() + type RandomStrategy struct + func (r *RandomStrategy) Add(params ...string) error + func (r *RandomStrategy) Get(key string) (string, error) + func (r *RandomStrategy) GetAll() ([]string, error) + func (r *RandomStrategy) Next() string + func (r *RandomStrategy) RemoveAll() error + type RoundRobinStrategy struct + func (r *RoundRobinStrategy) Add(params ...string) error + func (r *RoundRobinStrategy) Get(key string) (string, error) + func (r *RoundRobinStrategy) GetAll() ([]string, error) + func (r *RoundRobinStrategy) Next() string + func (r *RoundRobinStrategy) RemoveAll() error + type UInt32Slice []uint32 + func (s UInt32Slice) Len() int + func (s UInt32Slice) Less(i, j int) bool + func (s UInt32Slice) Swap(i, j int) + type WeightNode struct + type WeightRoundRobinStrategy struct + func (r *WeightRoundRobinStrategy) Add(params ...string) error + func (r *WeightRoundRobinStrategy) Get(key string) (string, error) + func (r *WeightRoundRobinStrategy) GetAll() ([]string, error) + func (r *WeightRoundRobinStrategy) Next() string + func (r *WeightRoundRobinStrategy) RemoveAll() error