| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package ops
- import (
- "f1-game/internal/code"
- nameActor "f1-game/internal/name/actor"
- nameRemote "f1-game/internal/name/remote"
- "f1-game/internal/pb"
- "f1-game/nodes/center/internal/db"
- "github.com/cherry-game/cherry/net/parser/pomelo"
- )
- var (
- pingReturn = &pb.Bool{Value: true}
- )
- type (
- actor struct {
- pomelo.ActorBase
- }
- )
- func NewActor() *actor {
- return &actor{}
- }
- func (p *actor) AliasID() string {
- return nameActor.CenterOps
- }
- func (p *actor) OnInit() {
- p.Remote().Register(nameRemote.CenterOps_Ping, p.ping)
- p.Remote().Register(nameRemote.CenterOps_Shutdown, p.shutdown)
- p.Remote().Register(nameRemote.CenterOps_DbReport, p.dbReport)
- }
- // ping 请求center是否响应
- func (p *actor) ping() (*pb.Bool, int32) {
- return pingReturn, code.OK
- }
- func (p *actor) shutdown() int32 {
- p.App().Shutdown()
- return code.OK
- }
- func (p *actor) dbReport() (*pb.DBQueueReportList, int32) {
- return db.Queue().Report(), code.OK
- }
|