Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAbleUsageRpcNodes = errors.New("no able usage rpc node")
)
Functions ¶
Types ¶
type Balancer ¶
type Balancer interface { // Scheme 负载均衡器的名字 // 默认实现RoundRobbin和Hash Scheme() string // IncNotify 用于增量通知, 适合地址列表少量变化的时候 IncNotify(keys []int, nodes []*loadbalance.RpcNode) // FullNotify 全量更新 FullNotify(nodes []*loadbalance.RpcNode) // Target 依赖Key从地址列表中给出一个地址 // 负载均衡器没有可用节点时则会返回error Target(service string) (loadbalance.RpcNode, error) }
func NewConsistentHash ¶
func NewConsistentHash() Balancer
func NewRoundRobin ¶
func NewRoundRobin() Balancer
Click to show internal directories.
Click to hide internal directories.