balance

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBalancer

func RegisterBalancer(balancer Balancer)

Types

type Balancer

type Balancer interface {
	// Scheme 负载均衡器的名字
	// 默认实现RoundRobbin和Hash
	Scheme() string
	// InitTable 初始化地址列表,负载均衡器接收来自解析器解析的初始地址信息
	InitTable(addr []string)
	// Notify 用于通知,地址解析器用来通知负载均衡器地址有变化
	Notify(key []int, value []string)
	// AppendAddrs 追加地址
	AppendAddrs(addr []string)
	// Target 依赖Key从地址列表中给出一个地址
	Target(key []byte) string
}

func GetBalancer

func GetBalancer(scheme string) Balancer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL