Documentation ¶
Overview ¶
Package encoding implements encoding/decoding data points.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferWriter ¶ added in v0.3.0
type BufferWriter interface { Write(data []byte) (n int, err error) WriteByte(b byte) error Bytes() []byte }
BufferWriter allows writing a variable-sized buffer of bytes.
type Packer ¶ added in v0.3.0
type Packer struct {
// contains filtered or unexported fields
}
Packer writes data into a buffer.
func NewPacker ¶ added in v0.3.0
func NewPacker(buf BufferWriter) *Packer
NewPacker returns a new Writer.
type ParseInterval ¶
ParseInterval parses the interval rule from the key in a kv pair.
type Reader ¶ added in v0.3.0
type Reader struct {
// contains filtered or unexported fields
}
Reader reads bits from buffer.
func NewReader ¶ added in v0.3.0
func NewReader(in io.ByteReader) *Reader
NewReader crate bit reader.
type SeriesDecoder ¶
type SeriesDecoder interface { // Decode the time series data Decode(key, data []byte) error // Len denotes the size of iterator Len() int // IsFull returns whether the encoded data reached its capacity IsFull() bool // Get the data point by its time Get(ts uint64) ([]byte, error) // Iterator returns a SeriesIterator Iterator() SeriesIterator // Range returns the start and end time of this series Range() (start, end uint64) }
SeriesDecoder decodes encoded time series data.
type SeriesDecoderPool ¶
type SeriesDecoderPool interface { Get(metadata []byte) SeriesDecoder Put(encoder SeriesDecoder) }
SeriesDecoderPool allows putting and getting SeriesDecoder.
func NewDecoderPool ¶ added in v0.3.0
func NewDecoderPool(name string, size int, fn ParseInterval) SeriesDecoderPool
NewDecoderPool returns a SeriesDecoderPool which provides int-based xor decoders.
type SeriesEncoder ¶
type SeriesEncoder interface { // Append a data point Append(ts uint64, value []byte) // IsFull returns whether the encoded data reached its capacity IsFull() bool // Reset the underlying buffer Reset(key []byte, buffer BufferWriter) // Encode the time series data point to a binary Encode() error // StartTime indicates the first entry's time StartTime() uint64 }
SeriesEncoder encodes time series data point.
type SeriesEncoderPool ¶
type SeriesEncoderPool interface { Get(metadata []byte, buffer BufferWriter) SeriesEncoder Put(encoder SeriesEncoder) }
SeriesEncoderPool allows putting and getting SeriesEncoder.
func NewEncoderPool ¶ added in v0.3.0
func NewEncoderPool(name string, size int, fn ParseInterval) SeriesEncoderPool
NewEncoderPool returns a SeriesEncoderPool which provides int-based xor encoders.
type SeriesIterator ¶
type SeriesIterator interface { // Next scroll the cursor to the next Next() bool // Val returns the value of the current data point Val() []byte // Time returns the time of the current data point Time() uint64 // Error might return an error indicates a decode failure Error() error }
SeriesIterator iterates time series data.
type Writer ¶ added in v0.3.0
type Writer struct {
// contains filtered or unexported fields
}
Writer writes bits to an io.BufferWriter.
func (*Writer) Flush ¶ added in v0.3.0
func (w *Writer) Flush()
Flush flushes the currently in-process byte.
func (*Writer) Reset ¶ added in v0.3.0
func (w *Writer) Reset(buffer BufferWriter)
Reset writes to a new writer.
type XORDecoder ¶
type XORDecoder struct {
// contains filtered or unexported fields
}
XORDecoder decodes buffer to uint64 values using xor compress.
func NewXORDecoder ¶
func NewXORDecoder(br *Reader) *XORDecoder
NewXORDecoder create zstdDecoder decompress buffer using xor.
func (*XORDecoder) Next ¶
func (d *XORDecoder) Next() bool
Next return if zstdDecoder has value in buffer using xor, do uncompress logic in next method, data format reference zstdEncoder format.
func (*XORDecoder) Reset ¶
func (d *XORDecoder) Reset()
Reset resets the underlying buffer to decode.
type XOREncoder ¶
type XOREncoder struct {
// contains filtered or unexported fields
}
XOREncoder intends to compress uint64 data https://www.vldb.org/pvldb/vol8/p1816-teller.pdf
func NewXOREncoder ¶
func NewXOREncoder(bw *Writer) *XOREncoder
NewXOREncoder creates xor zstdEncoder for compressing uint64 data.
func (*XOREncoder) Write ¶
func (e *XOREncoder) Write(val uint64)