plaincodec

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeadLength    = 4
	MaxPacketSize = 64 * 1024
)

Variables

View Source
var (
	ErrPacketSizeExcced   = errors.New("codec: packet size exceed")
	ErrWrongMessageType   = errors.New("codec: wrong message type")
	ErrInvalidMessage     = errors.New("codec: invalid message")
	ErrInvalidRouteLength = errors.New("codec: invalid route length")
)

Functions

This section is empty.

Types

type AtomicBool

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

AtomicBool is a wrapper for atomic int32

func (*AtomicBool) Load

func (ab *AtomicBool) Load() bool

Load atomicly load bool value

func (*AtomicBool) Store

func (ab *AtomicBool) Store(b bool)

Store atomicly store bool value

type AtomicInt32

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

func (*AtomicInt32) Load

func (ab *AtomicInt32) Load() int32

Load atomicly load bool value

func (*AtomicInt32) Store

func (ab *AtomicInt32) Store(b int32)

Store atomicly store bool value

type Codec

type Codec struct {
}

func NewCodec

func NewCodec() *Codec

func (*Codec) Entity

func (c *Codec) Entity(dictionary message.Dictionary) codec.CodecEntity

type CodecEntity

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

func NewCodecEntity

func NewCodecEntity(dictionary message.Dictionary) *CodecEntity

func (*CodecEntity) DecodeMessage

func (c *CodecEntity) DecodeMessage(data []byte) (*message.Message, error)

func (*CodecEntity) DecodePacket

func (c *CodecEntity) DecodePacket(data []byte) ([]*packet.Packet, error)

func (*CodecEntity) EncodeMessage

func (c *CodecEntity) EncodeMessage(m *message.Message) ([]byte, error)

func (*CodecEntity) EncodePacket

func (c *CodecEntity) EncodePacket(packets []*packet.Packet) ([]byte, error)

Jump to

Keyboard shortcuts

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