codec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

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)

func GetCodec

func GetCodec(name string) cellnet.Codec

获取编码器

func MustGetCodec

func MustGetCodec(name string) cellnet.Codec

指定编码器不存在时,报错

func RegisterCodec

func RegisterCodec(c cellnet.Codec)

注册编码器

Types

type CodecRecycler

type CodecRecycler interface {
	Free(data interface{}, ctx cellnet.ContextSet)
}

Codec.Encode内分配的资源,在必要时可以回收,例如内存池对象

Directories

Path Synopsis
test
Package test is a generated protocol buffer package.
Package test is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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