-
Notifications
You must be signed in to change notification settings - Fork 50
/
cluster.go
51 lines (41 loc) · 1.07 KB
/
cluster.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package cluster
const (
Master Kind = "master" // 管理服
Gate Kind = "gate" // 网关服
Node Kind = "node" // 节点服
Mesh Kind = "mesh" // 微服务
)
// Kind 集群实例类型
type Kind string
func (k Kind) String() string {
return string(k)
}
const (
Work State = "work" // 工作(节点正常工作,可以分配更多玩家到该节点)
Busy State = "busy" // 繁忙(节点资源紧张,不建议分配更多玩家到该节点上)
Hang State = "hang" // 挂起(节点即将关闭,正处于资源回收中)
Shut State = "shut" // 关闭(节点已经关闭,无法正常访问该节点)
)
// State 集群实例状态
type State string
func (s State) String() string {
return string(s)
}
const (
Connect Event = iota + 1 // 打开连接
Reconnect // 断线重连
Disconnect // 断开连接
)
// Event 事件
type Event int
func (e Event) String() string {
switch e {
case Connect:
return "connect"
case Reconnect:
return "reconnect"
case Disconnect:
return "disconnect"
}
return ""
}