transaction

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ITransactionMgr

type ITransactionMgr interface {
	// parameters:
	//   useUidLock:
	//     true: 每个uid最多只会有一个在执行中的协程(一般用于内存中留有uid相关信息的svr,如mainsvr)(后面的消息进队列)
	//     false:协程数与uid无关(一般用于无状态类的svr,如dbsvr)
	//   maxUidPendingPacket:
	//     当useUidLock=true时,此值为每个uid的消息等待队列的长度。
	InitAndRun(maxTrans int32, useUidLock bool, maxUidPendingPacket int)

	RegisterCmd(cmd uint32, cmdHandler cmd_handler.ICmdHandler)
	ProcessSSPacket(packet *sharedstruct.SSPacket)
}

func NewTransactionMgr

func NewTransactionMgr() ITransactionMgr

type Transaction

type Transaction struct {
	OriPacketHeader sharedstruct.SSPacketHeader
	// contains filtered or unexported fields
}

func (*Transaction) BroadcastByServerType

func (t *Transaction) BroadcastByServerType(svrType uint32, cmd uint32, req proto.Message) error

func (*Transaction) CallMsgByBusId

func (t *Transaction) CallMsgByBusId(busId uint32, cmd uint32, req proto.Message, rsp proto.Message) error

func (*Transaction) CallMsgBySvrType

func (t *Transaction) CallMsgBySvrType(svrType uint32, cmd uint32, req proto.Message, rsp proto.Message) error

func (*Transaction) CallOtherMsgBySvrType

func (t *Transaction) CallOtherMsgBySvrType(svrType uint32, cmd uint32, uid uint64, req proto.Message, rsp proto.Message) error

func (*Transaction) Cmd

func (t *Transaction) Cmd() uint32

func (*Transaction) DebugDepthf

func (t *Transaction) DebugDepthf(depth int, format string, args ...interface{})

func (*Transaction) Debugf

func (t *Transaction) Debugf(format string, args ...interface{})

func (*Transaction) Errorf

func (t *Transaction) Errorf(format string, args ...interface{})

func (*Transaction) Flag

func (t *Transaction) Flag() uint32

func (*Transaction) Infof

func (t *Transaction) Infof(format string, args ...interface{})

func (*Transaction) Ip

func (t *Transaction) Ip() uint32

func (*Transaction) OriSrcBusId

func (t *Transaction) OriSrcBusId() uint32

func (*Transaction) ParseMsg

func (t *Transaction) ParseMsg(data []byte, msg proto.Message) error

func (*Transaction) SendMsgBack

func (t *Transaction) SendMsgBack(pbMsg proto.Message)

func (*Transaction) SendMsgByServerType

func (t *Transaction) SendMsgByServerType(svrType uint32, cmd uint32, req proto.Message) error

func (*Transaction) TransID

func (t *Transaction) TransID() uint32

func (*Transaction) Uid

func (t *Transaction) Uid() uint64

func (*Transaction) Warningf

func (t *Transaction) Warningf(format string, args ...interface{})

type TransactionMgr

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

func (*TransactionMgr) InitAndRun

func (m *TransactionMgr) InitAndRun(maxTrans int32, useUidLock bool, maxUidPendingPacket int)

初始化

func (*TransactionMgr) ProcessSSPacket

func (m *TransactionMgr) ProcessSSPacket(packet *sharedstruct.SSPacket)

ProcessSSPacket将获得packet的所有权

func (*TransactionMgr) RegisterCmd

func (m *TransactionMgr) RegisterCmd(cmd uint32, cmdHandler cmd_handler.ICmdHandler)

注册命令字

func (*TransactionMgr) SendPbMsgToMyself

func (m *TransactionMgr) SendPbMsgToMyself(selfBusId uint32, uid uint64, cmd uint32, pbMsg proto.Message)

发给自己(SelfBusId)的消息直接调用ProcessSSPacket,而不到网络上转一圈

Jump to

Keyboard shortcuts

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