增加负载算法的接口约束

This commit is contained in:
2021-11-22 16:52:08 +08:00
parent 30059c0341
commit ffccdeffd4
2 changed files with 32 additions and 1 deletions

30
balance/abstract.go Normal file
View File

@ -0,0 +1,30 @@
// Package balance...
//
// Description : balance...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2021-11-22 4:45 下午
package balance
import (
"net/http"
"git.zhangdeman.cn/zhangdeman/gopkg/balance/define"
)
// IBalance 负载算法接口约束
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 4:45 下午 2021/11/22
type IBalance interface {
// GetServerNode 获取一个服务器节点
GetServerNode(req *http.Request) (*define.ServerNode, error)
// AddServerNode 新增一个服务器节点
AddServerNode(hostIP string, port int) error
// Remove 移除一个节点
Remove(hostIP string, port int, force bool)
// GetServerNodeList 获取服务节点列表
GetServerNodeList() []*define.ServerNode
}