Documentation ¶
Index ¶
- Constants
- Variables
- func MarshalEntry(timestamp int64, data []byte) []byte
- func NewEngine(path string, walPath string, opt tsdb.EngineOptions) tsdb.Engine
- func SplitEntries(b []byte) [][]byte
- func UnmarshalEntry(v []byte) (timestamp int64, data []byte, n int)
- type Cursor
- type Engine
- func (e *Engine) Backup(w io.Writer, basePath string, since time.Time) error
- func (e *Engine) Begin(writable bool) (tsdb.Tx, error)
- func (e *Engine) Close() error
- func (e *Engine) DeleteMeasurement(name string, seriesKeys []string) error
- func (e *Engine) DeleteSeries(keys []string) error
- func (e *Engine) Format() tsdb.EngineFormat
- func (e *Engine) LoadMetadataIndex(shard *tsdb.Shard, index *tsdb.DatabaseIndex, ...) error
- func (e *Engine) Open() error
- func (e *Engine) Path() string
- func (e *Engine) PerformMaintenance()
- func (e *Engine) SeriesBucketStats(key string) (stats bolt.BucketStats, err error)
- func (e *Engine) SeriesCount() (n int, err error)
- func (e *Engine) SetLogOutput(w io.Writer)
- func (e *Engine) Stats() (stats Stats, err error)
- func (e *Engine) WriteIndex(pointsByKey map[string][][]byte, ...) error
- func (e *Engine) WritePoints(points []models.Point, ...) error
- func (e *Engine) WriteTo(w io.Writer) (n int64, err error)
- type Stats
- type Tx
- type WAL
Constants ¶
const ( // DefaultBlockSize is the default size of uncompressed points blocks. DefaultBlockSize = 4 * 1024 // 4KB )
const (
// Format is the file format name of this engine.
Format = "bz1"
)
Variables ¶
var ( // ErrSeriesExists is returned when writing points to an existing series. ErrSeriesExists = errors.New("series exists") )
Functions ¶
func MarshalEntry ¶
MarshalEntry encodes point data into a single byte slice.
The format of the byte slice is:
uint64 timestamp uint32 data length []byte data
func SplitEntries ¶
SplitEntries returns a slice of individual entries from one continuous set.
Types ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor provides ordered iteration across a series.
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) DeleteMeasurement ¶
DeleteMeasurement deletes a measurement and all related series.
func (*Engine) DeleteSeries ¶
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) 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 ¶
SeriesCount returns the number of series buckets on the shard.
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.
type Stats ¶
type Stats struct {
Size int64 // BoltDB data size
}
Stats represents internal engine statistics.
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