Documentation ¶
Index ¶
- func DecodeMessage(msgid int, data []byte) (interface{}, *cellnet.MessageMeta, error)
- func EncodeMessage(msg interface{}, ctx cellnet.ContextSet) (data []byte, meta *cellnet.MessageMeta, err error)
- func FreeCodecResource(codec cellnet.Codec, data interface{}, ctx cellnet.ContextSet)
- func GetCodec(name string) cellnet.Codec
- func MustGetCodec(name string) cellnet.Codec
- func RegisterCodec(c cellnet.Codec)
- type CodecRecycler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeMessage ¶
func DecodeMessage(msgid int, data []byte) (interface{}, *cellnet.MessageMeta, error)
解码消息
func EncodeMessage ¶
func EncodeMessage(msg interface{}, ctx cellnet.ContextSet) (data []byte, meta *cellnet.MessageMeta, err error)
编码消息, 在使用了带内存池的codec中,可以传入session或peer的ContextSet,保存内存池上下文,默认ctx传nil
func FreeCodecResource ¶
func FreeCodecResource(codec cellnet.Codec, data interface{}, ctx cellnet.ContextSet)
Types ¶
type CodecRecycler ¶
type CodecRecycler interface {
Free(data interface{}, ctx cellnet.ContextSet)
}
Codec.Encode内分配的资源,在必要时可以回收,例如内存池对象
Click to show internal directories.
Click to hide internal directories.