优化节点call及send能力
This commit is contained in:
parent
5b96d43038
commit
66db3eb43f
@ -17,9 +17,10 @@ type INode interface {
|
||||
type ServiceNodeStateType int
|
||||
|
||||
const (
|
||||
SNST_Stateless = 0 // 无状态服务,如大厅,聊天服,匹配服,登陆服等
|
||||
SNST_Stateful = 1 // 有状态服务,主要是各类玩法服,需要记录玩家在哪个玩法服里面,以便消息不会发到同玩法的其它节点服上
|
||||
SNST_Ordered = 2 // 有序服务,主要是db服这类需要根据玩家id hash到固定的节点上,保证数据一致性
|
||||
SNST_Unknown = 0 // 无状态服务,如大厅,聊天服,匹配服,登陆服等
|
||||
SNST_Stateless = 1 // 无状态服务,如大厅,聊天服,匹配服,登陆服等
|
||||
SNST_Stateful = 2 // 有状态服务,主要是各类玩法服,需要记录玩家在哪个玩法服里面,以便消息不会发到同玩法的其它节点服上
|
||||
SNST_Ordered = 3 // 有序服务,主要是db服这类需要根据玩家id hash到固定的节点上,保证数据一致性
|
||||
)
|
||||
|
||||
func (s ServiceNodeStateType) String() string {
|
||||
@ -30,20 +31,21 @@ func (s ServiceNodeStateType) String() string {
|
||||
return "stateful"
|
||||
case SNST_Ordered:
|
||||
return "ordered"
|
||||
default:
|
||||
case SNST_Unknown:
|
||||
return "unknown"
|
||||
default:
|
||||
return fmt.Sprint(s)
|
||||
}
|
||||
}
|
||||
|
||||
// 服务节点信息,TypeId及Type都是标记同类型的节点,Name是区别该节点与其它节点的字段
|
||||
type ServiceNode struct {
|
||||
TypeId int `json:"type_id"` // 服务类型id,与Type字段功能一样, 由proto定义,gate通过该字段找到这类服务的所有节点信息
|
||||
Name string `json:"name"` // 服务名 多个同类服务依赖name区分:lobby1,lobby2,lobby3等等
|
||||
Type string `json:"type"` // 服务类型:lobby, game, gate等等
|
||||
Version string `json:"version"` // 版本号
|
||||
MinMsgId int `json:"min_msg_id"` // 能处理的最小消息id
|
||||
MaxMsgId int `json:"max_msg_id"` // 能处理的最大消息id
|
||||
ServiceType ServiceNodeStateType `json:"service_type"` // 无状态节点或有状态节点或有序节点
|
||||
TypeId int `json:"type_id"` // 服务类型id,与Type字段功能一样, 由proto定义,gate通过该字段找到这类服务的所有节点信息
|
||||
Name string `json:"name"` // 服务名 多个同类服务依赖name区分:lobby1,lobby2,lobby3等等
|
||||
Type string `json:"type"` // 服务类型:lobby, game, gate等等
|
||||
Version string `json:"version"` // 版本号
|
||||
MinMsgId int `json:"min_msg_id"` // 能处理的最小消息id
|
||||
MaxMsgId int `json:"max_msg_id"` // 能处理的最大消息id
|
||||
}
|
||||
|
||||
func (s ServiceNode) EtcdKey() string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user