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 ¶
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 ¶
PreparedBuffer represents a buffer stream with the first two bytes (type and version) removed.