codex

package
v0.0.0-...-7429fd7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	Decode(buf []byte, out interface{}) error
	Prepare(buf []byte) (*PreparedBuffer, error)
}

Decoder is the interface implemented by an object that can be decoded after stripping out its tag type and version.

type Encoder

type Encoder interface {
	Encode(otype uint8, version uint8, in interface{}) (*bytes.Buffer, error)
}

Encoder is the interface implemented by an object that can encode itself and tag its type and version.

type EncoderDecoder

type EncoderDecoder interface {
	Encoder
	Decoder
}

EncoderDecoder implements both encoding and decoding.

type MsgPakEncoderDecoder

type MsgPakEncoderDecoder struct{}

func NewMsgPak

func NewMsgPak() MsgPakEncoderDecoder

func (MsgPakEncoderDecoder) Decode

func (e MsgPakEncoderDecoder) Decode(buf []byte, out interface{}) error

Decode decodes a buffer using MessagePack. The buffer passed in needs to have removed the message type and version from the buf.

func (MsgPakEncoderDecoder) Encode

func (e MsgPakEncoderDecoder) Encode(msgType uint8, version uint8, in interface{}) (*bytes.Buffer, error)

Encode encodes a message using MessagePack. It prepends the message type and the passed in version to the returned buffer.

func (MsgPakEncoderDecoder) Prepare

func (e MsgPakEncoderDecoder) Prepare(buf []byte) (pb *PreparedBuffer, err error)

Prepare retrieves the message type, version, and a buffer that is ready to be sent to Decode.

type PreparedBuffer

type PreparedBuffer struct {
	Type    uint8
	Version uint8
	Bytes   []byte
}

PreparedBuffer represents a buffer stream with the first two bytes (type and version) removed.

Jump to

Keyboard shortcuts

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