cmd_handler

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdHandlerFunc added in v1.0.4

type CmdHandlerFunc func(c IContext, data []byte) g1_protocol.ErrorCode

type CmdHandlerMgr added in v1.1.0

type CmdHandlerMgr struct {
	// contains filtered or unexported fields
}

*

  • CmdHandlerMgr
  • @Description:

*

func NewCmdHandlerMgr added in v1.1.0

func NewCmdHandlerMgr() *CmdHandlerMgr

* * @Description: 创建cmdhandler管理器 * @return: *CmdHandler * @Author: Iori * @Date: 2022-08-11 17:54:43 *

func (*CmdHandlerMgr) GetHttpHandlers added in v1.1.0

func (self *CmdHandlerMgr) GetHttpHandlers(key string) (value WebHandlerFunc, ok bool)

* * @Description: get http handlers * @param: key * @return: value * @return: ok * @Author: Iori * @Date: 2022-04-26 17:31:21 *

func (*CmdHandlerMgr) GetWsHandlers added in v1.1.0

func (self *CmdHandlerMgr) GetWsHandlers(key string) (value WebHandlerFunc, ok bool)

* * @Description: get ws handlers * @param: key * @return: value * @return: ok * @Author: Iori * @Date: 2022-04-26 17:31:21 *

func (*CmdHandlerMgr) HttpRegister added in v1.1.0

func (self *CmdHandlerMgr) HttpRegister(key string, value WebHandlerFunc)

* * @Description: reg http handler * @param: key * @param: value * @Author: Iori * @Date: 2022-04-26 17:31:33 *

func (*CmdHandlerMgr) Init added in v1.1.0

func (self *CmdHandlerMgr) Init(impl RegCmdInterface) error

* * @Description: 初始化cmdhandler管理器 * @return: *CmdHandler * @Author: Iori * @Date: 2022-08-11 17:54:43 *

func (*CmdHandlerMgr) WsRegister added in v1.1.0

func (self *CmdHandlerMgr) WsRegister(key string, value WebHandlerFunc)

* * @Description: reg Ws Handlers * @param: key * @param: value * @Author: Iori * @Date: 2022-04-26 17:31:33 *

type IContext

type IContext interface {
	Uid() uint64
	Zone() uint32
	Rid() uint64
	OriSrcBusId() uint32
	Ip() uint32
	Flag() uint32

	ParseMsg(data []byte, msg proto.Message) error

	CallMsgBySvrType(svrType uint32, cmd g1_protocol.CMD, req proto.Message, rsp proto.Message) error                                         // 常规rpc call
	CallMsgByRouter(svrType uint32, routerId uint64, cmd g1_protocol.CMD, req proto.Message, rsp proto.Message) error                         // 带自定义路由的 call
	CallOtherMsgBySvrType(svrType uint32, routerId, uid uint64, zone uint32, cmd g1_protocol.CMD, req proto.Message, rsp proto.Message) error //附带其他玩家id的call
	SendMsgBack(pbMsg proto.Message)                                                                                                          //rpc msg back
	SendMsgByServerType(svrType uint32, cmd g1_protocol.CMD, req proto.Message) error                                                         // 常规rpc send
	SendMsgByRouter(svrType uint32, routerId uint64, cmd g1_protocol.CMD, req proto.Message) error                                            //带自定义路由的 send

	Errorf(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Debugf(format string, args ...interface{})
}

Transaction 实现了这个借口,在事务运行时保存了上下文

type RegCmdInterface added in v1.1.0

type RegCmdInterface interface {
	Init() error
	RegHttpCmd()
	RegWsCmd()
}

type WebHandlerFunc added in v1.1.0

type WebHandlerFunc func(c *gin.Context, data []byte) gin.H

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL