tsdb: github.com/prometheus/tsdb/chunkenc Index | Files

package chunkenc

import "github.com/prometheus/tsdb/chunkenc"

Index

Package Files

bstream.go chunk.go xor.go

type Appender Uses

type Appender interface {
    Append(int64, float64)
}

Appender adds sample pairs to a chunk.

type Chunk Uses

type Chunk interface {
    Bytes() []byte
    Encoding() Encoding
    Appender() (Appender, error)
    // The iterator passed as argument is for re-use.
    // Depending on implementation, the iterator can
    // be re-used or a new iterator can be allocated.
    Iterator(Iterator) Iterator
    NumSamples() int
}

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

func FromData Uses

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

FromData returns a chunk from a byte slice of chunk data. This is there so that users of the library can easily create chunks from bytes.

type Encoding Uses

type Encoding uint8

Encoding is the identifier for a chunk encoding.

const (
    EncNone Encoding = iota
    EncXOR
)

The different available chunk encodings.

func (Encoding) String Uses

func (e Encoding) String() string

type Iterator Uses

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

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

func NewNopIterator Uses

func NewNopIterator() Iterator

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

type Pool Uses

type Pool interface {
    Put(Chunk) error
    Get(e Encoding, b []byte) (Chunk, error)
}

Pool is used to create and reuse chunk references to avoid allocations.

func NewPool Uses

func NewPool() Pool

NewPool returns a new pool.

type XORChunk Uses

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

XORChunk holds XOR encoded sample data.

func NewXORChunk Uses

func NewXORChunk() *XORChunk

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

func (*XORChunk) Appender Uses

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

Appender implements the Chunk interface.

func (*XORChunk) Bytes Uses

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

Bytes returns the underlying byte slice of the chunk.

func (*XORChunk) Encoding Uses

func (c *XORChunk) Encoding() Encoding

Encoding returns the encoding type.

func (*XORChunk) Iterator Uses

func (c *XORChunk) Iterator(it Iterator) Iterator

Iterator implements the Chunk interface.

func (*XORChunk) NumSamples Uses

func (c *XORChunk) NumSamples() int

NumSamples returns the number of samples in the chunk.

Package chunkenc imports 7 packages (graph) and is imported by 15 packages. Updated 2019-07-11. Refresh now. Tools for package owners.