Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorInvalidBalance = errors.New("invalid balance")
)
Functions ¶
func Register ¶
func Register(key string, factory IBalanceFactory)
Register 注册balance工厂到默认balanceFactory注册器
Types ¶
type IBalanceFactory ¶
type IBalanceFactory interface {
Create(app discovery.IApp) (IBalanceHandler, error)
}
IBalanceFactory 实现了负载均衡算法工厂
func GetFactory ¶
func GetFactory(name string) (IBalanceFactory, error)
GetFactory 获取指定负载均衡算法工厂,若指定的不存在则返回一个已注册的工厂
type IBalanceFactoryRegister ¶
type IBalanceFactoryRegister interface { RegisterFactoryByKey(key string, factory IBalanceFactory) GetFactoryByKey(key string) (IBalanceFactory, bool) Keys() []string }
IBalanceFactoryRegister 实现了负载均衡算法工厂管理器
type IBalanceHandler ¶
IBalanceHandler 实现了负载均衡算法
Click to show internal directories.
Click to hide internal directories.