Documentation
¶
Index ¶
- Variables
- func Decodev1(b []byte, d *Data) (err error)
- func Decodev2(b []byte, d *Data) (err error)
- func Decodev3(buf v3.Reader, e interface{}) error
- func Encodev2(d Data, values *bytes.Buffer)
- func Encodev3(d interface{}, out io.Writer) error
- func RegisterTransmitter(tr Transmitter) error
- type Data
- type Key
- type Transmitter
- type V3Decoder
- type V3Encoder
Constants ¶
This section is empty.
Variables ¶
var ( //ErrCodeUsed is for when the code for the transmitter is already used ErrCodeUsed = errors.New("code already used") //ErrInvalidInput is used for when the input it invalid ErrInvalidInput = errors.New("invalid input") )
Functions ¶
func RegisterTransmitter ¶
func RegisterTransmitter(tr Transmitter) error
RegisterTransmitter registers a new transmitter
Types ¶
type Data ¶
type Data map[interface{}]interface{}
Data is the type
type Key ¶
type Key struct { Value []byte //the key to the data of this object in its final form Vtype byte //the type of the data of this object in its final form }
Key is the key used for storing the key of a Value
type Transmitter ¶
type Transmitter interface { Encode() ([]byte, error) Decode([]byte) (interface{}, error) GetCode() byte }
Transmitter transmits the data
type V3Decoder ¶
V3Decoder is the decoder used to decode a ttv3 data stream
func NewV3Decoder ¶
NewV3Decoder creates aa new V3Decoder to decode a ttv3 data stream. The init flag specifies wether it should initialize the decoder. Initializing the decoder blocks until at least the first 2 bytes are read.
func (*V3Decoder) Decode ¶
Decode decodes a one ttv3 encoded value from a stream. Note that a stream of one value is the same as one value just with the stream bit set
func (*V3Decoder) Init ¶
Init initizes the decoder, initizlizing blocks until at least the first 2 bytes are read.
func (*V3Decoder) SetAllocLimmit ¶ added in v0.8.0
SetAllocLimmit sets the limmit of allocations. This does not induce a global limmit in tt but only for individual allocations
type V3Encoder ¶
V3Encoder is the encoder used to encode a ttv3 data stream
func NewV3Encoder ¶
NewV3Encoder creates a new encoder to encode a ttv3 data stream