tsdb

package
v0.10.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B1 = iota
	BZ1
	TSM1
)

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 ConvertToValue

func ConvertToValue(k int64, v interface{}) tsm.Value

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 BoolValue

type BoolValue struct {
	T time.Time
	V bool
}

func (*BoolValue) Size

func (b *BoolValue) Size() int

func (*BoolValue) String

func (f *BoolValue) String() string

func (*BoolValue) Time

func (b *BoolValue) Time() time.Time

func (*BoolValue) UnixNano

func (b *BoolValue) UnixNano() int64

func (*BoolValue) Value

func (b *BoolValue) Value() interface{}

type Cursor

type Cursor interface {
	SeekTo(seek int64) (key int64, value interface{})
	Next() (key int64, value interface{})
}

Cursor represents an iterator over a series.

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

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

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

DecodeFields decodes a byte slice into a set of field ids and values.

func (*FieldCodec) DecodeFieldsWithNames

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

DecodeFieldsWithNames decodes a byte slice into a set of field names and values

func (*FieldCodec) EncodeFields

func (f *FieldCodec) EncodeFields(values map[string]interface{}) ([]byte, error)

EncodeFields converts a map of values with string keys to a byte slice of field IDs and values.

If a field exists in the codec, but its type is different, an error is returned. If a field is not present in the codec, the system panics.

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.

func (*FieldCodec) Fields

func (f *FieldCodec) Fields() (a []*Field)

type FloatValue

type FloatValue struct {
	T time.Time
	V float64
}

func (*FloatValue) Size

func (f *FloatValue) Size() int

func (*FloatValue) String

func (f *FloatValue) String() string

func (*FloatValue) Time

func (f *FloatValue) Time() time.Time

func (*FloatValue) UnixNano

func (f *FloatValue) UnixNano() int64

func (*FloatValue) Value

func (f *FloatValue) Value() interface{}

type Int64Value

type Int64Value struct {
	T time.Time
	V int64
}

func (*Int64Value) Size

func (v *Int64Value) Size() int

func (*Int64Value) String

func (f *Int64Value) String() string

func (*Int64Value) Time

func (v *Int64Value) Time() time.Time

func (*Int64Value) UnixNano

func (v *Int64Value) UnixNano() int64

func (*Int64Value) Value

func (v *Int64Value) Value() interface{}

type MeasurementFields

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

MeasurementFields is a mapping from measurements to its fields.

func (*MeasurementFields) MarshalBinary

func (m *MeasurementFields) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object to a binary format.

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.

func (*Series) MarshalBinary

func (s *Series) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object to a binary format.

func (*Series) UnmarshalBinary

func (s *Series) UnmarshalBinary(buf []byte) error

UnmarshalBinary decodes the object from a binary format.

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

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)

type StringValue

type StringValue struct {
	T time.Time
	V string
}

func (*StringValue) Size

func (v *StringValue) Size() int

func (*StringValue) String

func (f *StringValue) String() string

func (*StringValue) Time

func (v *StringValue) Time() time.Time

func (*StringValue) UnixNano

func (v *StringValue) UnixNano() int64

func (*StringValue) Value

func (v *StringValue) Value() interface{}

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