tsdb - ActiveState ActiveGo 1.8
...

Package tsdb

import "github.com/influxdata/influxdb/cmd/influx_tsm/tsdb"
Overview
Index
Subdirectories

Overview ▾

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

Constants

Flags for differentiating between engines

const (
    B1 = iota
    BZ1
    TSM1
)

Variables

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

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.

type Database

Database represents an entire database on disk.

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

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

EngineFormat holds the flag for the engine

type EngineFormat int

func (EngineFormat) String

func (e EngineFormat) String() string

String returns the string format of the engine.

type Field

Field represents an encoded field.

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

type FieldCodec

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

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

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

MeasurementFields is a mapping from measurements to its fields.

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

func (*MeasurementFields) UnmarshalBinary

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

UnmarshalBinary decodes the object from a binary format.

type Series

Series represents a series in the shard.

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

type ShardInfo

ShardInfo is the description of a shard on disk.

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

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

ShardInfos is an array of ShardInfo

type ShardInfos []*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)

Subdirectories

Name Synopsis
..