b1

package
v0.9.5-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2015 License: MIT Imports: 14 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) Ascending

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

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 {

	// 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) Format

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

func (*Engine) PerformMaintenance

func (e *Engine) PerformMaintenance()

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

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

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 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 over a single field.

Jump to

Keyboard shortcuts

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