v0.1.6 Latest Latest

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

Go to latest
Published: Aug 24, 2015 License: MIT Imports: 16 Imported by: 0




View Source
const (
	// DefaultBlockSize is the default size of uncompressed points blocks.
	DefaultBlockSize = 32 * 1024 // 32KB
View Source
const (
	// Format is the file format name of this engine.
	Format = "bz1"


View Source
var (
	// ErrSeriesExists is returned when writing points to an existing series.
	ErrSeriesExists = errors.New("series exists")


func MarshalEntry

func MarshalEntry(timestamp int64, data []byte) []byte

MarshalEntry encodes point data into a single byte slice.

The format of the byte slice is:

uint64 timestamp
uint32 data length
[]byte data

func NewEngine

func NewEngine(path string, opt tsdb.EngineOptions) tsdb.Engine

NewEngine returns a new instance of Engine.

func SplitEntries

func SplitEntries(b []byte) [][]byte

SplitEntries returns a slice of individual entries from one continuous set.

func UnmarshalEntry

func UnmarshalEntry(v []byte) (timestamp int64, data []byte, n int)

UnmarshalEntry decodes an entry into it's separate parts. Returns the timestamp, data and the number of bytes read. Returned byte slices point to the original slice.


type Cursor

type Cursor struct {
	// contains filtered or unexported fields

Cursor provides ordered iteration across a series.

func (*Cursor) Next

func (c *Cursor) Next() (key, value []byte)

Next returns the next key/value pair from the cursor.

func (*Cursor) Seek

func (c *Cursor) Seek(seek []byte) (key, value []byte)

Seek moves the cursor to a position and returns the closest key/value pair.

type Engine

type Engine struct {

	// Write-ahead log storage.

	// Size of uncompressed points to write to a block.
	BlockSize int
	// contains filtered or unexported fields

Engine represents a storage engine with compressed blocks.

func (*Engine) Begin

func (e *Engine) Begin(writable bool) (tsdb.Tx, error)

Begin starts a new transaction on the engine.

func (*Engine) Close

func (e *Engine) Close() error

Close closes the engine.

func (*Engine) DeleteMeasurement

func (e *Engine) DeleteMeasurement(name string, seriesKeys []string) error

DeleteMeasurement deletes a measurement and all related series.

func (*Engine) DeleteSeries

func (e *Engine) DeleteSeries(keys []string) error

DeleteSeries deletes the series from the engine.

func (*Engine) LoadMetadataIndex

func (e *Engine) LoadMetadataIndex(index *tsdb.DatabaseIndex, measurementFields map[string]*tsdb.MeasurementFields) error

LoadMetadataIndex loads the shard metadata into memory.

func (*Engine) Open

func (e *Engine) Open() error

Open opens and initializes the engine.

func (*Engine) Path

func (e *Engine) Path() string

Path returns the path the engine was opened with.

func (*Engine) SeriesCount

func (e *Engine) SeriesCount() (n int, err error)

SeriesCount returns the number of series buckets on the shard.

func (*Engine) SetLogOutput

func (e *Engine) SetLogOutput(w io.Writer)

SetLogOutput is a no-op.

func (*Engine) Stats

func (e *Engine) Stats() (stats Stats, err error)

Stats returns internal statistics for the engine.

func (*Engine) WriteIndex

func (e *Engine) WriteIndex(pointsByKey map[string][][]byte, measurementFieldsToSave map[string]*tsdb.MeasurementFields, seriesToCreate []*tsdb.SeriesCreate) error

WriteIndex writes marshaled points to the engine's underlying index.

func (*Engine) WritePoints

func (e *Engine) WritePoints(points []tsdb.Point, measurementFieldsToSave map[string]*tsdb.MeasurementFields, seriesToCreate []*tsdb.SeriesCreate) error

WritePoints writes metadata and point data into the engine. Returns an error if new points are added to an existing key.

type Stats

type Stats struct {
	Size int64 // BoltDB data size

Stats represents internal engine statistics.

type Tx

type Tx struct {
	// contains filtered or unexported fields

Tx represents a transaction.

func (*Tx) Cursor

func (tx *Tx) Cursor(key string) tsdb.Cursor

Cursor returns an iterator for a key.

type WAL

type WAL interface {
	WritePoints(points []tsdb.Point, measurementFieldsToSave map[string]*tsdb.MeasurementFields, seriesToCreate []*tsdb.SeriesCreate) error
	LoadMetadataIndex(index *tsdb.DatabaseIndex, measurementFields map[string]*tsdb.MeasurementFields) error
	DeleteSeries(keys []string) error
	Cursor(key string) tsdb.Cursor
	Open() error
	Close() error

WAL represents a write ahead log that can be queried

Jump to

Keyboard shortcuts

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