processor

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonMsgRaw

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

type JsonProcessor

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

func NewJsonProcessor

func NewJsonProcessor() *JsonProcessor

func (*JsonProcessor) GetMsgInfo

func (p *JsonProcessor) GetMsgInfo(msg interface{}) (*MsgInfo, error)

func (*JsonProcessor) Marshal

func (p *JsonProcessor) Marshal(msg interface{}) ([][]byte, error)

goroutine safe

func (*JsonProcessor) Register

func (p *JsonProcessor) Register(msg interface{}, msgHandleWayType MsgHandleWayType) string

Register It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*JsonProcessor) Route

func (p *JsonProcessor) Route(msg interface{}, userData interface{}) error

goroutine safe

func (*JsonProcessor) SetHandler

func (p *JsonProcessor) SetHandler(msg interface{}, msgHandler MsgHandler)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*JsonProcessor) SetRawHandler

func (p *JsonProcessor) SetRawHandler(msgID string, msgRawHandler MsgHandler)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*JsonProcessor) SetRouter

func (p *JsonProcessor) SetRouter(msg interface{}, msgRouter *chanrpc.Server)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*JsonProcessor) Unmarshal

func (p *JsonProcessor) Unmarshal(data []byte) (interface{}, error)

goroutine safe

type MsgHandleWayType

type MsgHandleWayType uint

MsgHandleWayType 定义支持的消息处理方式类型

const (
	MsgHandleWayTypeGlobalSync MsgHandleWayType = iota // 全局同步 会交由全局的消息队列进行同步调度到具体handle
	MsgHandleWayTypeAgentSync                          // 交由agent本身的消息队列 同步调度到具体handle
	MsgHandleWayTypeAgentAsync                         // 交由agent本身的消息队列 异s步调度到具体handle
)

func (MsgHandleWayType) Valid

func (receiver MsgHandleWayType) Valid() bool

type MsgHandler

type MsgHandler func([]interface{})

type MsgInfo

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

func (*MsgInfo) GetMsgHandleWayType

func (m *MsgInfo) GetMsgHandleWayType() MsgHandleWayType

func (*MsgInfo) GetMsgRouter

func (m *MsgInfo) GetMsgRouter() *chanrpc.Server

func (*MsgInfo) GetMsgType

func (m *MsgInfo) GetMsgType() reflect.Type

type Processor

type Processor interface {
	// must goroutine safe
	Route(msg interface{}, userData interface{}) error
	// must goroutine safe
	Unmarshal(data []byte) (interface{}, error)
	// must goroutine safe
	Marshal(msg interface{}) ([][]byte, error)
	GetMsgInfo(msg interface{}) (*MsgInfo, error)
}

type ProtobufMsgRaw

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

type ProtobufProcessor

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

------------------------- | id | protobuf message | -------------------------

func NewProtobufProcessor

func NewProtobufProcessor() *ProtobufProcessor

func (*ProtobufProcessor) GetMsgInfo

func (p *ProtobufProcessor) GetMsgInfo(msg interface{}) (*MsgInfo, error)

func (*ProtobufProcessor) GetMsgNameId

func (p *ProtobufProcessor) GetMsgNameId() map[string]uint16

func (*ProtobufProcessor) Marshal

func (p *ProtobufProcessor) Marshal(msg interface{}) ([][]byte, error)

goroutine safe

func (*ProtobufProcessor) Range

func (p *ProtobufProcessor) Range(f func(id uint16, t reflect.Type))

goroutine safe

func (*ProtobufProcessor) Register

func (p *ProtobufProcessor) Register(msg proto.Message, eventType uint16, msgHandleWayType MsgHandleWayType) uint16

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*ProtobufProcessor) Route

func (p *ProtobufProcessor) Route(msg interface{}, userData interface{}) error

goroutine safe

func (*ProtobufProcessor) SetByteOrder

func (p *ProtobufProcessor) SetByteOrder(littleEndian bool)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*ProtobufProcessor) SetHandler

func (p *ProtobufProcessor) SetHandler(msg proto.Message, msgHandler MsgHandler)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*ProtobufProcessor) SetRawHandler

func (p *ProtobufProcessor) SetRawHandler(id uint16, msgRawHandler MsgHandler)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*ProtobufProcessor) SetRouter

func (p *ProtobufProcessor) SetRouter(msg proto.Message, msgRouter *chanrpc.Server)

It's dangerous to call the method on routing or marshaling (unmarshaling)

func (*ProtobufProcessor) Unmarshal

func (p *ProtobufProcessor) Unmarshal(data []byte) (interface{}, error)

goroutine safe

Jump to

Keyboard shortcuts

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