tsdb

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Pacage tsdb abstracts the various shard types supported by the influx_tsm command.

Index

Constants

View Source
const (
	B1 = iota
	BZ1
	TSM1
)

Flags for differentiating between engines

Variables

View Source
var (
	// ErrFieldNotFound is returned when a field cannot be found.
	ErrFieldNotFound = errors.New("field not found")

	// ErrFieldUnmappedID is returned when the system is presented, during decode, with a field ID
	// there is no mapping for.
	ErrFieldUnmappedID = errors.New("field ID not mapped")
)

Functions

func DecodeKeyValue

func DecodeKeyValue(field string, dec *FieldCodec, k, v []byte) (int64, interface{})

DecodeKeyValue decodes the key and value from bytes.

func MeasurementFromSeriesKey

func MeasurementFromSeriesKey(key string) string

MeasurementFromSeriesKey returns the Measurement name for a given series.

Types

type Database

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

Database represents an entire database on disk.

func NewDatabase

func NewDatabase(path string) *Database

NewDatabase creates a database instance using data at path.

func (*Database) Name

func (d *Database) Name() string

Name returns the name of the database.

func (*Database) Path

func (d *Database) Path() string

Path returns the path to the database.

func (*Database) Shards

func (d *Database) Shards() ([]*ShardInfo, error)

Shards returns information for every shard in the database.

type EngineFormat

type EngineFormat int

EngineFormat holds the flag for the engine

func (EngineFormat) String

func (e EngineFormat) String() string

String returns the string format of the engine.

type Field

type Field struct {
	ID   uint8             `json:"id,omitempty"`
	Name string            `json:"name,omitempty"`
	Type influxql.DataType `json:"type,omitempty"`
}

Field represents an encoded field.

type FieldCodec

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

FieldCodec provides encoding and decoding functionality for the fields of a given Measurement.

func NewFieldCodec

func NewFieldCodec(fields map[string]*Field) *FieldCodec

NewFieldCodec returns a FieldCodec for the given Measurement. Must be called with a RLock that protects the Measurement.

func (*FieldCodec) DecodeByID

func (f *FieldCodec) DecodeByID(targetID uint8, b []byte) (interface{}, error)

DecodeByID scans a byte slice for a field with the given ID, converts it to its expected type, and return that value.

func (*FieldCodec) DecodeByName

func (f *FieldCodec) DecodeByName(name string, b []byte) (interface{}, error)

DecodeByName scans a byte slice for a field with the given name, converts it to its expected type, and return that value.

func (*FieldCodec) FieldByName

func (f *FieldCodec) FieldByName(name string) *Field

FieldByName returns the field by its name. It will return a nil if not found

func (*FieldCodec) FieldIDByName

func (f *FieldCodec) FieldIDByName(s string) (uint8, error)

FieldIDByName returns the ID for the given field.

type MeasurementFields

type MeasurementFields struct {
	Fields map[string]*Field `json:"fields"`
	Codec  *FieldCodec
}

MeasurementFields is a mapping from measurements to its fields.

func (*MeasurementFields) UnmarshalBinary

func (m *MeasurementFields) UnmarshalBinary(buf []byte) error

UnmarshalBinary decodes the object from a binary format.

type Series

type Series struct {
	Key  string
	Tags map[string]string
}

Series represents a series in the shard.

type ShardInfo

type ShardInfo struct {
	Database        string
	RetentionPolicy string
	Path            string
	Format          EngineFormat
	Size            int64
}

ShardInfo is the description of a shard on disk.

func (*ShardInfo) FormatAsString

func (s *ShardInfo) FormatAsString() string

FormatAsString returns the format of the shard as a string.

func (*ShardInfo) FullPath

func (s *ShardInfo) FullPath(dataPath string) string

FullPath returns the full path to the shard, given the data directory root.

type ShardInfos

type ShardInfos []*ShardInfo

ShardInfos is an array of ShardInfo

func (ShardInfos) Databases

func (s ShardInfos) Databases() []string

Databases returns the sorted unique set of databases for the shards.

func (ShardInfos) ExclusiveDatabases

func (s ShardInfos) ExclusiveDatabases(exc []string) ShardInfos

ExclusiveDatabases returns a copy of the ShardInfo, with shards associated with the given databases present. If the given set is empty, all databases are returned.

func (ShardInfos) FilterFormat

func (s ShardInfos) FilterFormat(fmt EngineFormat) ShardInfos

FilterFormat returns a copy of the ShardInfos, with shards of the given format removed.

func (ShardInfos) Len

func (s ShardInfos) Len() int

func (ShardInfos) Less

func (s ShardInfos) Less(i, j int) bool

func (ShardInfos) Size

func (s ShardInfos) Size() int64

Size returns the space on disk consumed by the shards.

func (ShardInfos) Swap

func (s ShardInfos) Swap(i, j int)

Directories

Path Synopsis
Package internal is a generated protocol buffer package.
Package internal is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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