processor

package
v2.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MsgTypeSize = 2
View Source
const RawMsgTypeSize = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectHandler

type ConnectHandler func(clientId string)

type ConnectJsonHandler

type ConnectJsonHandler func(clientId string)

type IProcessor

type IProcessor interface {
	// MsgRoute must goroutine safe
	MsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte)) error
	// UnknownMsgRoute must goroutine safe
	UnknownMsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte))
	// ConnectedRoute connect event
	ConnectedRoute(clientId string)
	DisConnectedRoute(clientId string)

	// Unmarshal must goroutine safe
	Unmarshal(clientId string, data []byte) (interface{}, error)
	// Marshal must goroutine safe
	Marshal(clientId string, msg interface{}) ([]byte, error)
}

type IRawProcessor

type IRawProcessor interface {
	IProcessor

	SetByteOrder(littleEndian bool)
	SetRawMsgHandler(handle RawMessageHandler)
	MakeRawMsg(msgType uint16, msg []byte, pbRawPackInfo *PBRawPackInfo)
	SetUnknownMsgHandler(unknownMessageHandler UnknownRawMessageHandler)
	SetConnectedHandler(connectHandler RawConnectHandler)
	SetDisConnectedHandler(disconnectHandler RawConnectHandler)
}

type JsonPackInfo

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

func (*JsonPackInfo) GetMsg

func (slf *JsonPackInfo) GetMsg() interface{}

func (*JsonPackInfo) GetPackType

func (slf *JsonPackInfo) GetPackType() uint16

type JsonProcessor

type JsonProcessor struct {
	LittleEndian bool

	bytespool.IBytesMemPool
	// contains filtered or unexported fields
}

func NewJsonProcessor

func NewJsonProcessor() *JsonProcessor

func (*JsonProcessor) ConnectedRoute

func (jsonProcessor *JsonProcessor) ConnectedRoute(clientId string)

func (*JsonProcessor) DisConnectedRoute

func (jsonProcessor *JsonProcessor) DisConnectedRoute(clientId string)

func (*JsonProcessor) MakeMsg

func (jsonProcessor *JsonProcessor) MakeMsg(msgType uint16, msg interface{}) *JsonPackInfo

func (*JsonProcessor) MakeRawMsg

func (jsonProcessor *JsonProcessor) MakeRawMsg(msgType uint16, msg []byte) *JsonPackInfo

func (*JsonProcessor) Marshal

func (jsonProcessor *JsonProcessor) Marshal(clientId string, msg interface{}) ([]byte, error)

func (*JsonProcessor) MsgRoute

func (jsonProcessor *JsonProcessor) MsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte)) error

MsgRoute must goroutine safe

func (*JsonProcessor) Register

func (jsonProcessor *JsonProcessor) Register(msgType uint16, msg interface{}, handle MessageJsonHandler)

func (*JsonProcessor) RegisterConnected

func (jsonProcessor *JsonProcessor) RegisterConnected(connectHandler ConnectJsonHandler)

func (*JsonProcessor) RegisterDisConnected

func (jsonProcessor *JsonProcessor) RegisterDisConnected(disconnectHandler ConnectJsonHandler)

func (*JsonProcessor) RegisterUnknownMsg

func (jsonProcessor *JsonProcessor) RegisterUnknownMsg(unknownMessageHandler UnknownMessageJsonHandler)

func (*JsonProcessor) SetByteOrder

func (jsonProcessor *JsonProcessor) SetByteOrder(littleEndian bool)

func (*JsonProcessor) UnknownMsgRoute

func (jsonProcessor *JsonProcessor) UnknownMsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte))

func (*JsonProcessor) Unmarshal

func (jsonProcessor *JsonProcessor) Unmarshal(clientId string, data []byte) (interface{}, error)

type MessageHandler

type MessageHandler func(clientId string, msg proto.Message)

type MessageInfo

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

type MessageJsonHandler

type MessageJsonHandler func(clientId string, msg interface{})

type MessageJsonInfo

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

type PBPackInfo

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

func (*PBPackInfo) GetMsg

func (slf *PBPackInfo) GetMsg() proto.Message

func (*PBPackInfo) GetPackType

func (slf *PBPackInfo) GetPackType() uint16

type PBProcessor

type PBProcessor struct {
	LittleEndian bool

	bytespool.IBytesMemPool
	// contains filtered or unexported fields
}

func NewPBProcessor

func NewPBProcessor() *PBProcessor

func (*PBProcessor) ConnectedRoute

func (pbProcessor *PBProcessor) ConnectedRoute(clientId string)

func (*PBProcessor) DisConnectedRoute

func (pbProcessor *PBProcessor) DisConnectedRoute(clientId string)

func (*PBProcessor) MakeMsg

func (pbProcessor *PBProcessor) MakeMsg(msgType uint16, protoMsg proto.Message) *PBPackInfo

func (*PBProcessor) MakeRawMsg

func (pbProcessor *PBProcessor) MakeRawMsg(msgType uint16, msg []byte) *PBPackInfo

func (*PBProcessor) Marshal

func (pbProcessor *PBProcessor) Marshal(clientId string, msg interface{}) ([]byte, error)

Marshal must goroutine safe

func (*PBProcessor) MsgRoute

func (pbProcessor *PBProcessor) MsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte)) error

MsgRoute must goroutine safe

func (*PBProcessor) Register

func (pbProcessor *PBProcessor) Register(msgType uint16, msg proto.Message, handle MessageHandler)

func (*PBProcessor) RegisterConnected

func (pbProcessor *PBProcessor) RegisterConnected(connectHandler ConnectHandler)

func (*PBProcessor) RegisterDisConnected

func (pbProcessor *PBProcessor) RegisterDisConnected(disconnectHandler ConnectHandler)

func (*PBProcessor) RegisterUnknownMsg

func (pbProcessor *PBProcessor) RegisterUnknownMsg(unknownMessageHandler UnknownMessageHandler)

func (*PBProcessor) SetByteOrder

func (pbProcessor *PBProcessor) SetByteOrder(littleEndian bool)

func (*PBProcessor) UnknownMsgRoute

func (pbProcessor *PBProcessor) UnknownMsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte))

func (*PBProcessor) Unmarshal

func (pbProcessor *PBProcessor) Unmarshal(clientId string, data []byte) (interface{}, error)

Unmarshal must goroutine safe

func (*PBProcessor) UnmarshalWithOutRelease

func (pbProcessor *PBProcessor) UnmarshalWithOutRelease(clientId string, data []byte) (interface{}, error)

UnmarshalWithOutRelease not release data

type PBRawPackInfo

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

func (*PBRawPackInfo) GetMsg

func (slf *PBRawPackInfo) GetMsg() []byte

func (*PBRawPackInfo) GetPackType

func (slf *PBRawPackInfo) GetPackType() uint16

func (*PBRawPackInfo) SetPackInfo

func (slf *PBRawPackInfo) SetPackInfo(typ uint16, rawMsg []byte)

type PBRawProcessor

type PBRawProcessor struct {
	LittleEndian bool
	// contains filtered or unexported fields
}

func NewPBRawProcessor

func NewPBRawProcessor() *PBRawProcessor

func (*PBRawProcessor) ConnectedRoute

func (pbRawProcessor *PBRawProcessor) ConnectedRoute(clientId string)

func (*PBRawProcessor) DisConnectedRoute

func (pbRawProcessor *PBRawProcessor) DisConnectedRoute(clientId string)

func (*PBRawProcessor) MakeRawMsg

func (pbRawProcessor *PBRawProcessor) MakeRawMsg(msgType uint16, msg []byte, pbRawPackInfo *PBRawPackInfo)

func (*PBRawProcessor) Marshal

func (pbRawProcessor *PBRawProcessor) Marshal(clientId string, msg interface{}) ([]byte, error)

Marshal must goroutine safe

func (*PBRawProcessor) MsgRoute

func (pbRawProcessor *PBRawProcessor) MsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte)) error

MsgRoute must goroutine safe

func (*PBRawProcessor) SetByteOrder

func (pbRawProcessor *PBRawProcessor) SetByteOrder(littleEndian bool)

func (*PBRawProcessor) SetConnectedHandler

func (pbRawProcessor *PBRawProcessor) SetConnectedHandler(connectHandler RawConnectHandler)

func (*PBRawProcessor) SetDisConnectedHandler

func (pbRawProcessor *PBRawProcessor) SetDisConnectedHandler(disconnectHandler RawConnectHandler)

func (*PBRawProcessor) SetRawMsgHandler

func (pbRawProcessor *PBRawProcessor) SetRawMsgHandler(handle RawMessageHandler)

func (*PBRawProcessor) SetUnknownMsgHandler

func (pbRawProcessor *PBRawProcessor) SetUnknownMsgHandler(unknownMessageHandler UnknownRawMessageHandler)

func (*PBRawProcessor) UnknownMsgRoute

func (pbRawProcessor *PBRawProcessor) UnknownMsgRoute(clientId string, msg interface{}, recyclerReaderBytes func(data []byte))

func (*PBRawProcessor) Unmarshal

func (pbRawProcessor *PBRawProcessor) Unmarshal(clientId string, data []byte) (interface{}, error)

Unmarshal must goroutine safe

type RawConnectHandler

type RawConnectHandler func(clientId string)

type RawMessageHandler

type RawMessageHandler func(clientId string, packType uint16, msg []byte)

type RawMessageInfo

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

type UnknownMessageHandler

type UnknownMessageHandler func(clientId string, msg []byte)

type UnknownMessageJsonHandler

type UnknownMessageJsonHandler func(clientId string, msg []byte)

type UnknownRawMessageHandler

type UnknownRawMessageHandler func(clientId string, msg []byte)

Jump to

Keyboard shortcuts

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