bz1

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

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

Variables

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

Functions

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, walPath 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.

Types

type Cursor

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

Cursor provides ordered iteration across a series.

func (*Cursor) Ascending added in v0.9.5

func (c *Cursor) Ascending() bool

func (*Cursor) Next

func (c *Cursor) Next() (key int64, value interface{})

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

func (*Cursor) SeekTo added in v0.9.5

func (c *Cursor) SeekTo(seek int64) (key int64, value interface{})

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

type Engine

type Engine struct {

	// Write-ahead log storage.
	WAL WAL

	// 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) Format added in v0.9.5

func (e *Engine) Format() tsdb.EngineFormat

Format returns the format type of this engine

func (*Engine) LoadMetadataIndex

func (e *Engine) LoadMetadataIndex(shard *tsdb.Shard, 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) PerformMaintenance added in v0.9.5

func (e *Engine) PerformMaintenance()

PerformMaintenance is for periodic maintenance of the store. A no-op for bz1

func (*Engine) SeriesBucketStats

func (e *Engine) SeriesBucketStats(key string) (stats bolt.BucketStats, err error)

SeriesBucketStats returns internal BoltDB stats for a series bucket.

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 []models.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.

func (*Engine) WriteTo added in v0.9.4

func (e *Engine) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the length and contents of the engine to w.

type Stats

type Stats struct {
	Size int64 // BoltDB data size
}

Stats represents internal engine statistics.

type Tx

type Tx struct {
	*bolt.Tx
	// contains filtered or unexported fields
}

Tx represents a transaction.

func (*Tx) Cursor

func (tx *Tx) Cursor(series string, fields []string, dec *tsdb.FieldCodec, ascending bool) tsdb.Cursor

Cursor returns an iterator for a key.

type WAL

type WAL interface {
	WritePoints(points []models.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(series string, fields []string, dec *tsdb.FieldCodec, ascending bool) tsdb.Cursor
	Open() error
	Close() error
	Flush() 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