cmd_handler

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: MIT Imports: 2 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 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 实现了这个借口,在事务运行时保存了上下文

Jump to

Keyboard shortcuts

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