chunkenc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToUint64

func ToUint64(bytes []byte) []uint64

Types

type Appender

type Appender interface {
	Append(int64, float64)
	Chunk() Chunk
}

Appender adds sample pairs to a chunk.

type Chunk

type Chunk interface {
	Bytes() []byte
	Clear()
	Encoding() Encoding
	Appender() (Appender, error)
	Iterator() Iterator
}

Chunk holds a sequence of sample pairs that can be iterated over and appended to.

func FromData

func FromData(e Encoding, d []byte, samples uint16) (Chunk, error)

FromData returns a chunk from a byte slice of chunk data.

func NewXORChunk

func NewXORChunk() Chunk

NewXORChunk returns a new chunk with XOR encoding of the given size.

type Encoding

type Encoding uint8

Encoding is the identifier for a chunk encoding.

const (
	EncNone Encoding = 0
	EncXOR  Encoding = 1
)

The different available chunk encodings.

func (Encoding) String

func (e Encoding) String() string

type Iterator

type Iterator interface {
	At() (int64, float64)
	Err() error
	Next() bool
}

Iterator is a simple iterator that can only get the next value.

func NewNopIterator

func NewNopIterator() Iterator

NewNopIterator returns a new chunk iterator that does not hold any data.

type XORChunk

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

XORChunk holds XOR encoded sample data.

func (*XORChunk) Appender

func (c *XORChunk) Appender() (Appender, error)

Appender implements the Chunk interface. new implementation, doesnt read the existing buffer, assume its new

func (*XORChunk) Bytes

func (c *XORChunk) Bytes() []byte

Bytes returns the underlying byte slice of the chunk.

func (*XORChunk) Clear

func (c *XORChunk) Clear()

func (*XORChunk) Encoding

func (c *XORChunk) Encoding() Encoding

Encoding returns the encoding type.

func (*XORChunk) Iterator

func (c *XORChunk) Iterator() Iterator

Iterator implements the Chunk interface.

Jump to

Keyboard shortcuts

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