encoding

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// TsLen equals ts(uint64) + data_offset(uint32)
	TsLen = 8 + 4
)

Variables

View Source
var ErrEncodeEmpty = errors.New("encode an empty value")
View Source
var ErrInvalidValue = errors.New("invalid encoded value")

Functions

This section is empty.

Types

type ParseInterval

type ParseInterval = func(key []byte) time.Duration

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
}

SeriesDecoder decodes encoded time series data

type SeriesDecoderPool

type SeriesDecoderPool interface {
	Get(metadata []byte) SeriesDecoder
	Put(encoder SeriesDecoder)
}

func NewIntDecoderPool

func NewIntDecoderPool(size int, fn ParseInterval) SeriesDecoderPool

func NewPlainDecoderPool

func NewPlainDecoderPool(size int) SeriesDecoderPool

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)
	// Encode the time series data point to a binary
	Encode() ([]byte, error)
	// StartTime indicates the first entry's time
	StartTime() uint64
}

SeriesEncoder encodes time series data point

type SeriesEncoderPool

type SeriesEncoderPool interface {
	Get(metadata []byte) SeriesEncoder
	Put(encoder SeriesEncoder)
}

func NewIntEncoderPool

func NewIntEncoderPool(size int, fn ParseInterval) SeriesEncoderPool

func NewPlainEncoderPool

func NewPlainEncoderPool(size int) SeriesEncoderPool

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 XORDecoder

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

XORDecoder decodes buffer to uint64 values using xor compress

func NewXORDecoder

func NewXORDecoder(br *bit.Reader) *XORDecoder

NewXORDecoder create zstdDecoder decompress buffer using xor

func (*XORDecoder) Err

func (d *XORDecoder) Err() error

Err returns error raised in Next()

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

func (*XORDecoder) Value

func (d *XORDecoder) Value() uint64

Value returns uint64 from buffer

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 *bit.Writer) *XOREncoder

NewXOREncoder creates xor zstdEncoder for compressing uint64 data

func (*XOREncoder) Write

func (e *XOREncoder) Write(val uint64)

Jump to

Keyboard shortcuts

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