b1

package
v0.9.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Format = "b1"

Format is the file format name of this engine.

View Source
const WALPartitionN = 8

WALPartitionN is the number of partitions in the write ahead log.

Variables

View Source
var (
	// ErrWALPartitionNotFound returns when flushing a partition that does not exist.
	ErrWALPartitionNotFound = errors.New("wal partition not found")
)

Functions

func NewEngine

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

NewEngine returns a new instance of Engine. walPath isn't used in b1, but had to be added for later engine versions.

func WALPartition

func WALPartition(key []byte) uint8

WALPartition returns the partition number that key belongs to.

Types

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 {

	// The maximum size and time thresholds for flushing the WAL.
	MaxWALSize             int
	WALFlushInterval       time.Duration
	WALPartitionFlushDelay time.Duration

	// The writer used by the logger.
	LogOutput io.Writer
	// contains filtered or unexported fields
}

Engine represents a version 1 storage engine.

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

func (*Engine) DB

func (e *Engine) DB() *bolt.DB

DB returns the underlying Bolt database.

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) Flush

func (e *Engine) Flush(partitionFlushDelay time.Duration) error

Flush writes all points from the write ahead log to the index.

func (*Engine) FlushPartition

func (e *Engine) FlushPartition(partitionID uint8) error

FlushPartition flushes a single WAL partition.

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 initialized with.

func (*Engine) SeriesCount

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

SeriesCount returns the number of series buckets on the shard. This does not include a count from the WAL.

func (*Engine) SetLogOutput

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

SetLogOutput sets the writer used for log output. This must be set before opening the engine.

func (*Engine) WritePoints

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

WritePoints will write the raw data points and any new metadata to the index in the shard

type Tx

type Tx struct {
	*bolt.Tx
	// 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.

Jump to

Keyboard shortcuts

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