codec

package
v0.0.0-...-26c2032 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 2 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{}, *cellnetEx.MessageMeta, error)

解码消息

func EncodeMessage

func EncodeMessage(msg interface{}, ctx cellnetEx.ContextSet) (data []byte, meta *cellnetEx.MessageMeta, err error)

编码消息, 在使用了带内存池的codec中,可以传入session或peer的ContextSet,保存内存池上下文,默认ctx传nil

func FreeCodecResource

func FreeCodecResource(codec cellnetEx.Codec, data interface{}, ctx cellnetEx.ContextSet)

func GetCodec

func GetCodec(name string) cellnetEx.Codec

获取编码器

func MustGetCodec

func MustGetCodec(name string) cellnetEx.Codec

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

func RegisterCodec

func RegisterCodec(c cellnetEx.Codec)

注册编码器

Types

type CodecRecycler

type CodecRecycler interface {
	Free(data interface{}, ctx cellnetEx.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