Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomerBalancer ¶
func LocalFirst ¶
func LocalFirst(service string, ip string, r naming.Resolver, limit map[string]int) CustomerBalancer
LocalFirst returns a Balancer that selects addresses round-robin. It uses r to watch the name resolution updates and updates the addresses available correspondingly.
func RoundRobin ¶
func RoundRobin(service string, r naming.Resolver, limit map[string]int, log *logger.Logger) CustomerBalancer
RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch the name resolution updates and updates the addresses available correspondingly.
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter 限流组件,用于限制客户端每分钟请求服务器的数量,当超过限制数量时不再选择该服务提供者
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver 服务解析器,用于解析不同的注册中心地址,创建注册中心watcher
type ServiceResolver ¶
type ServiceResolver interface { // Resolve creates a Watcher for target. Resolve(target string) (naming.Watcher, error) Close() }
func NewResolver ¶
func NewResolver(service string, timeout time.Duration, sortPrefix string) ServiceResolver
NewResolver 返回服务解析器
Click to show internal directories.
Click to hide internal directories.