db

package
v0.0.0-...-625be2c Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2013 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Init() (err error)
	WriteRow(wRecord WriteRecord, src string) (rowKey string, err error)
	ReadRow(req RowRequest) (returnVal *ReadRecord, err error)
	ReadRows(req RowRangeRequests) (returnVal *DataTable, err error)
	DeleteRow(rowKey string) (err error)
	WriteDir(si SourceInfoUncomp, src string) (err error)
	ReadDir(req DirectorySearchRequest) (result SourceInfoUncomp, err error)
	DeleteDir(path, file string) (err error)
}

type DataTable

type DataTable struct {
	ColumnNames        []string      `json:"aggregatesColumnNames,omitempty"`
	Data               []*[]*float64 `json:"aggregates,omitempty"`
	IdColumn           []string      `json:"ids,omitempty"`
	ConfigsColumnNames []string      `json:"configsColumnNames,omitempty"`
	Configs            []*[]*string  `json:"configs,omitempty"`
	Timestamps         []*float64    `json:"timestamps,omitempty"`
}

func MergeDataTables

func MergeDataTables(dTables []*DataTable, srcs []string, returnIds,
	returnConfigs bool) (resultTable *DataTable)

MergeDataTables returns a single DataTable from multiple ones. Rows and columns are not in any defined order. To sort columns use: SortDataColumns() To sort rows use: SortRows(colNum) or ReverseSortRows(colNum)

func (*DataTable) ChangeXAxisToColumnFromTime

func (d *DataTable) ChangeXAxisToColumnFromTime(colName string) error

func (*DataTable) ChangeXAxisToConfigColumn

func (d *DataTable) ChangeXAxisToConfigColumn(colName string, fromTime bool) error

func (*DataTable) ChangeXAxisToRecordNumFromTime

func (d *DataTable) ChangeXAxisToRecordNumFromTime()

func (*DataTable) DeleteColumn

func (d *DataTable) DeleteColumn(colName string) error

func (*DataTable) GetVerifiedRegression

func (d *DataTable) GetVerifiedRegression(rParams regress.RegressionParams)

func (*DataTable) IndexForConfigName

func (d *DataTable) IndexForConfigName(colName string) (int, error)

func (*DataTable) IndexForName

func (d *DataTable) IndexForName(colName string) (int, error)

func (*DataTable) OverwriteXAxisWithRecordNum

func (d *DataTable) OverwriteXAxisWithRecordNum()

func (*DataTable) ReverseRows

func (d *DataTable) ReverseRows()

func (*DataTable) ReverseSortRows

func (d *DataTable) ReverseSortRows(colIdx int)

func (*DataTable) ReverseSortRowsStable

func (d *DataTable) ReverseSortRowsStable(colIdx int)

func (*DataTable) SortConfigsColumns

func (d *DataTable) SortConfigsColumns()

func (*DataTable) SortDataColumns

func (d *DataTable) SortDataColumns()

func (*DataTable) SortRows

func (d *DataTable) SortRows(colIdx int)

func (*DataTable) SortRowsStable

func (d *DataTable) SortRowsStable(colIdx int)

type DirectorySearchRequest

type DirectorySearchRequest struct {
	Prefix                  string
	FileRestrict            string
	ReturnMetrics           bool
	ReturnUnits             bool
	ReturnSelectForDefaults bool
	DefaultsOnly            bool
	DirPrefixMatch          bool
	FilePrefixMatch         bool
}

type FilteredSource

type FilteredSource struct {
	Source           string
	MetricsFilter    map[string]bool
	AggregatesFilter map[string]bool
	ConfigsFilter    map[string]string // Setting key only will separate into different configs.
}

src:metric.aggregate$key1=value1$key2=value2 decomposes into below.

type PointsRecord

type PointsRecord struct {
	Name       string    `json:"name,omitempty"`
	Timestamps []int64   `json:"timestamps,omitempty"`
	Data       []float64 `json:"data,omitempty"`
}

type Qualifier

type Qualifier struct {
	StartTimestamp int64
	EndTimestamp   int64
	MaxResults     int

	SetAggregateIfMissing bool

	EqualX       bool
	SortByColumn string
	SortByConfig string // Overrides SortByColumn if both set.
	NoTimeColumn bool

	ReturnIds          bool
	ReturnConfigs      bool
	NoReturnAggregates bool
}

type ReadRecord

type ReadRecord struct {
	Source                *string           `json:"source,omitempty"`
	RecordTimestamp       *int64            `json:"recordTimestamp,omitempty"`
	PointsColumnNames     []string          `json:"pointsColumnNames,omitempty"`
	Points                []*[]*float64     `json:"points,omitempty"`
	PointsDataType        string            `json:"pointsDataType,omitempty"`
	AggregatesColumnNames []string          `json:"aggregatesColumnNames,omitempty"`
	Aggregates            []*float64        `json:"aggregates,omitempty"`
	AggregatesDataType    string            `json:"aggregatesDataType,omitempty"`
	ConfigPairs           map[string]string `json:"configPairs,omitempty"`
	Id                    string            `json:"id,omitempty"`
}

func (*ReadRecord) SortAggregates

func (r *ReadRecord) SortAggregates()

func (*ReadRecord) SortPoints

func (r *ReadRecord) SortPoints()

type RowRangeRequests

type RowRangeRequests struct {
	FilteredSources []FilteredSource
	Qualifier
}

type RowRequest

type RowRequest struct {
	Id                 string
	NoReturnAggregates bool
}

type SourceInfoUncomp

type SourceInfoUncomp struct {
	Names             []string `json:"names,omitempty"`
	Units             []string `json:"units,omitempty"`
	SelectForDefaults []bool   `json:"selectForDefaults,omitempty"`
}

type StringSlice

type StringSlice []string

func (StringSlice) IndexForName

func (s StringSlice) IndexForName(name string) (int, error)

type WriteRecord

type WriteRecord struct {
	RecordTimestamp       *int64            `json:"recordTimestamp,omitempty"`
	Points                []PointsRecord    `json:"points,omitempty"`
	PointsDataType        string            `json:"pointsDataType,omitempty"`
	AggregatesColumnNames []string          `json:"aggregatesColumnNames,omitempty"`
	Aggregates            []*float64        `json:"aggregates,omitempty"`
	AggregatesDataType    string            `json:"aggregatesDataType,omitempty"`
	ConfigPairs           map[string]string `json:"configPairs,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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