Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrServerBusy = errors.New("Get server failed, busy")
ErrServerBusy 服务器忙
Functions ¶
This section is empty.
Types ¶
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer 负载均衡器
func (*LoadBalancer) GetServerByType ¶
func (app *LoadBalancer) GetServerByType(t uint8) (*iserver.ServerInfo, error)
GetServerByType 轮询获取服务器
func (*LoadBalancer) GetServerList ¶
func (app *LoadBalancer) GetServerList() ([]*iserver.ServerInfo, error)
GetServerList 获取最新的服务器列表
type LoadUpdater ¶
type LoadUpdater struct {
// contains filtered or unexported fields
}
LoadUpdater 负载更新器
func NewLoadUpdater ¶
func NewLoadUpdater(ctrl iUpdateCtrl, serverID uint64, interval time.Duration) *LoadUpdater
NewLoadUpdater 创建负载更新器 服务器需要提供GetLoad方法获取负载信息 需要指定负载信息更新间隔
type ServerMgr ¶
type ServerMgr struct {
*LoadBalancer
}
ServerMgr 服务器管理类
func (*ServerMgr) RegState ¶
func (mgr *ServerMgr) RegState(server *iserver.ServerInfo) error
RegState 注册服务器信息
func (*ServerMgr) Unregister ¶
func (mgr *ServerMgr) Unregister(server *iserver.ServerInfo) error
Unregister 将服务器信息从redis中删除
Click to show internal directories.
Click to hide internal directories.