engine

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_SERIES_IN_RESPONSE = 10000
)
View Source
const MaxInt = int(^uint(0) >> 1)
View Source
const (
	POINT_BATCH_SIZE = 64
)

Variables

View Source
var (
	TRUE = true
)

Functions

func DivideOperator

func DivideOperator(elems []*parser.Value, fields []string, point *protocol.Point) (*protocol.FieldValue, error)

func Filter

func Filter(query *parser.SelectQuery, series *protocol.Series) (*protocol.Series, error)

func GetRegisteredAggregators

func GetRegisteredAggregators() (names []string)

used in testing to get a list of all aggregators

func GetValue

func GetValue(value *parser.Value, fields []string, point *protocol.Point) (*protocol.FieldValue, error)

func MinusOperator

func MinusOperator(elems []*parser.Value, fields []string, point *protocol.Point) (*protocol.FieldValue, error)

func MultiplyOperator

func MultiplyOperator(elems []*parser.Value, fields []string, point *protocol.Point) (*protocol.FieldValue, error)

func PlusOperator

func PlusOperator(elems []*parser.Value, fields []string, point *protocol.Point) (*protocol.FieldValue, error)

func SortInt64

func SortInt64(ints []int64)

Types

type AbstractAggregator

type AbstractAggregator struct {
	Aggregator
	// contains filtered or unexported fields
}

func (*AbstractAggregator) CalculateSummaries

func (self *AbstractAggregator) CalculateSummaries(state interface{})

func (*AbstractAggregator) InitializeFieldsMetadata

func (self *AbstractAggregator) InitializeFieldsMetadata(series *protocol.Series) error

type Aggregator

type Aggregator interface {
	AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)
	InitializeFieldsMetadata(series *protocol.Series) error
	GetValues(state interface{}) [][]*protocol.FieldValue
	CalculateSummaries(state interface{})
	ColumnNames() []string
}

func NewBottomAggregator

func NewBottomAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewCompositeAggregator

func NewCompositeAggregator(left, right Aggregator) (Aggregator, error)

func NewCountAggregator

func NewCountAggregator(q *parser.SelectQuery, v *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewCumulativeArithmeticAggregator

func NewCumulativeArithmeticAggregator(name string, value *parser.Value, initialValue float64, defaultValue *parser.Value, operation Operation) (Aggregator, error)

func NewDerivativeAggregator

func NewDerivativeAggregator(q *parser.SelectQuery, v *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewDifferenceAggregator

func NewDifferenceAggregator(q *parser.SelectQuery, v *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewDistinctAggregator

func NewDistinctAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewFirstAggregator

func NewFirstAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewFirstOrLastAggregator

func NewFirstOrLastAggregator(name string, v *parser.Value, isFirst bool, defaultValue *parser.Value) (Aggregator, error)

func NewHistogramAggregator

func NewHistogramAggregator(q *parser.SelectQuery, v *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewLastAggregator

func NewLastAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewMaxAggregator

func NewMaxAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewMeanAggregator

func NewMeanAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewMedianAggregator

func NewMedianAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewMinAggregator

func NewMinAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewModeAggregator

func NewModeAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewPercentileAggregator

func NewPercentileAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewStandardDeviationAggregator

func NewStandardDeviationAggregator(q *parser.SelectQuery, v *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewSumAggregator

func NewSumAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewTopAggregator

func NewTopAggregator(_ *parser.SelectQuery, value *parser.Value, defaultValue *parser.Value) (Aggregator, error)

func NewTopOrBottomAggregator

func NewTopOrBottomAggregator(name string, v *parser.Value, isTop bool, defaultValue *parser.Value) (Aggregator, error)

type AggregatorInitializer

type AggregatorInitializer func(*parser.SelectQuery, *parser.Value, *parser.Value) (Aggregator, error)

Initialize a new aggregator given the query, the function call of the aggregator and the default value that should be returned if the bucket doesn't have any points

type ArithmeticOperator

type ArithmeticOperator func(elems []*parser.Value, fields []string, point *protocol.Point) (*protocol.FieldValue, error)

type BooleanOperation

type BooleanOperation func(leftValue *protocol.FieldValue, rightValues []*protocol.FieldValue) (OperatorResult, error)

type ByPointColumnAsc

type ByPointColumnAsc struct {
	protocol.PointsCollection
}

func (ByPointColumnAsc) Less

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

type ByPointColumnDesc

type ByPointColumnDesc struct {
	protocol.PointsCollection
}

Top, Bottom aggregators

func (ByPointColumnDesc) Less

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

type CompositeAggregator

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

func (*CompositeAggregator) AggregatePoint

func (self *CompositeAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*CompositeAggregator) CalculateSummaries

func (self *CompositeAggregator) CalculateSummaries(state interface{})

func (*CompositeAggregator) ColumnNames

func (self *CompositeAggregator) ColumnNames() []string

func (*CompositeAggregator) GetValues

func (self *CompositeAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

func (*CompositeAggregator) InitializeFieldsMetadata

func (self *CompositeAggregator) InitializeFieldsMetadata(series *protocol.Series) error

type CompositeAggregatorState

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

type CountAggregator

type CountAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*CountAggregator) AggregatePoint

func (self *CountAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*CountAggregator) ColumnNames

func (self *CountAggregator) ColumnNames() []string

func (*CountAggregator) GetValues

func (self *CountAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

func (*CountAggregator) InitializeFieldsMetadata

func (self *CountAggregator) InitializeFieldsMetadata(series *protocol.Series) error

type CountAggregatorState

type CountAggregatorState int64

type CumulativeArithmeticAggregator

type CumulativeArithmeticAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*CumulativeArithmeticAggregator) AggregatePoint

func (self *CumulativeArithmeticAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*CumulativeArithmeticAggregator) ColumnNames

func (self *CumulativeArithmeticAggregator) ColumnNames() []string

func (*CumulativeArithmeticAggregator) GetValues

func (self *CumulativeArithmeticAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type CumulativeArithmeticAggregatorState

type CumulativeArithmeticAggregatorState float64

type DerivativeAggregator

type DerivativeAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*DerivativeAggregator) AggregatePoint

func (self *DerivativeAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*DerivativeAggregator) ColumnNames

func (self *DerivativeAggregator) ColumnNames() []string

func (*DerivativeAggregator) GetValues

func (self *DerivativeAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type DerivativeAggregatorState

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

type DifferenceAggregator

type DifferenceAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*DifferenceAggregator) AggregatePoint

func (self *DifferenceAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*DifferenceAggregator) ColumnNames

func (self *DifferenceAggregator) ColumnNames() []string

func (*DifferenceAggregator) GetValues

func (self *DifferenceAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type DifferenceAggregatorState

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

type DistinctAggregator

type DistinctAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*DistinctAggregator) AggregatePoint

func (self *DistinctAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*DistinctAggregator) ColumnNames

func (self *DistinctAggregator) ColumnNames() []string

func (*DistinctAggregator) GetValues

func (self *DistinctAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type DistinctAggregatorState

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

type EngineI

type EngineI interface {
	RunQuery(user common.User, database string, query string, localOnly bool, yield func(*protocol.Series) error) error
}

type FilteringEngine

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

func NewFilteringEngine

func NewFilteringEngine(query *parser.SelectQuery, processor QueryProcessor) *FilteringEngine

func (*FilteringEngine) Close

func (self *FilteringEngine) Close()

func (*FilteringEngine) GetName

func (self *FilteringEngine) GetName() string

func (*FilteringEngine) SetShardInfo

func (self *FilteringEngine) SetShardInfo(shardId int, shardLocal bool)

func (*FilteringEngine) YieldPoint

func (self *FilteringEngine) YieldPoint(seriesName *string, columnNames []string, point *p.Point) bool

optimize for yield series and use it here

func (*FilteringEngine) YieldSeries

func (self *FilteringEngine) YieldSeries(seriesIncoming *p.Series) bool

type FirstOrLastAggregator

type FirstOrLastAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*FirstOrLastAggregator) AggregatePoint

func (self *FirstOrLastAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*FirstOrLastAggregator) ColumnNames

func (self *FirstOrLastAggregator) ColumnNames() []string

func (*FirstOrLastAggregator) GetValues

func (self *FirstOrLastAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type FirstOrLastAggregatorState

type FirstOrLastAggregatorState *protocol.FieldValue

type HistogramAggregator

type HistogramAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*HistogramAggregator) AggregatePoint

func (self *HistogramAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*HistogramAggregator) ColumnNames

func (self *HistogramAggregator) ColumnNames() []string

func (*HistogramAggregator) GetValues

func (self *HistogramAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type HistogramAggregatorState

type HistogramAggregatorState map[int]int

type Int64Slice

type Int64Slice []int64

Int64Slice attaches the methods of sort.Interface to []int64, sorting in increasing order.

func (Int64Slice) Len

func (p Int64Slice) Len() int

func (Int64Slice) Less

func (p Int64Slice) Less(i, j int) bool

func (Int64Slice) Swap

func (p Int64Slice) Swap(i, j int)

type Limiter

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

func NewLimiter

func NewLimiter(limit int) *Limiter

type ListSeriesEngine

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

func NewListSeriesEngine

func NewListSeriesEngine(responseChan chan *protocol.Response) *ListSeriesEngine

func (*ListSeriesEngine) Close

func (self *ListSeriesEngine) Close()

func (*ListSeriesEngine) GetName

func (self *ListSeriesEngine) GetName() string

func (*ListSeriesEngine) SetShardInfo

func (self *ListSeriesEngine) SetShardInfo(shardId int, shardLocal bool)

func (*ListSeriesEngine) YieldPoint

func (self *ListSeriesEngine) YieldPoint(seriesName *string, columnNames []string, point *protocol.Point) bool

func (*ListSeriesEngine) YieldSeries

func (self *ListSeriesEngine) YieldSeries(seriesIncoming *protocol.Series) bool

type MeanAggregator

type MeanAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*MeanAggregator) AggregatePoint

func (self *MeanAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*MeanAggregator) ColumnNames

func (self *MeanAggregator) ColumnNames() []string

func (*MeanAggregator) GetValues

func (self *MeanAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type MeanAggregatorState

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

type ModeAggregator

type ModeAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*ModeAggregator) AggregatePoint

func (self *ModeAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*ModeAggregator) ColumnNames

func (self *ModeAggregator) ColumnNames() []string

func (*ModeAggregator) GetValues

func (self *ModeAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type ModeAggregatorState

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

type Node

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

func (*Node) CountLeafNodes

func (self *Node) CountLeafNodes() int

func (*Node) GetChildNode

func (self *Node) GetChildNode(value *protocol.FieldValue) *Node

type Nodes

type Nodes []*Node

type Operation

type Operation func(currentValue float64, newValue *protocol.FieldValue) float64

type OperatorResult

type OperatorResult int
const (
	MATCH OperatorResult = iota
	NO_MATCH
	INVALID
)

func EqualityOperator

func EqualityOperator(leftValue, rightValue *protocol.FieldValue) (OperatorResult, error)

func GreaterThanOperator

func GreaterThanOperator(leftValue, rightValue *protocol.FieldValue) (OperatorResult, error)

func GreaterThanOrEqualOperator

func GreaterThanOrEqualOperator(leftValue, rightValue *protocol.FieldValue) (OperatorResult, error)

func InOperator

func InOperator(leftValue *protocol.FieldValue, rightValue []*protocol.FieldValue) (OperatorResult, error)

func RegexMatcherOperator

func RegexMatcherOperator(leftValue, rightValue *protocol.FieldValue) (OperatorResult, error)

type PassthroughEngine

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

func NewPassthroughEngine

func NewPassthroughEngine(responseChan chan *protocol.Response, maxPointsInResponse int) *PassthroughEngine

func NewPassthroughEngineWithLimit

func NewPassthroughEngineWithLimit(responseChan chan *protocol.Response, maxPointsInResponse, limit int) *PassthroughEngine

func (*PassthroughEngine) Close

func (self *PassthroughEngine) Close()

func (*PassthroughEngine) GetName

func (self *PassthroughEngine) GetName() string

func (*PassthroughEngine) SetShardInfo

func (self *PassthroughEngine) SetShardInfo(shardId int, shardLocal bool)

func (*PassthroughEngine) YieldPoint

func (self *PassthroughEngine) YieldPoint(seriesName *string, columnNames []string, point *protocol.Point) bool

func (*PassthroughEngine) YieldSeries

func (self *PassthroughEngine) YieldSeries(seriesIncoming *protocol.Series) bool

type PercentileAggregator

type PercentileAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*PercentileAggregator) AggregatePoint

func (self *PercentileAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*PercentileAggregator) CalculateSummaries

func (self *PercentileAggregator) CalculateSummaries(state interface{})

func (*PercentileAggregator) ColumnNames

func (self *PercentileAggregator) ColumnNames() []string

func (*PercentileAggregator) GetValues

func (self *PercentileAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type PercentileAggregatorState

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

type PointRange

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

func (*PointRange) UpdateRange

func (self *PointRange) UpdateRange(point *protocol.Point)

type PointSlice

type PointSlice []protocol.Point

type QueryEngine

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

func NewQueryEngine

func NewQueryEngine(query *parser.SelectQuery, responseChan chan *protocol.Response) (*QueryEngine, error)

func (*QueryEngine) Close

func (self *QueryEngine) Close()

func (*QueryEngine) GetName

func (self *QueryEngine) GetName() string

func (*QueryEngine) SendQueryStats

func (self *QueryEngine) SendQueryStats()

func (*QueryEngine) SetShardInfo

func (self *QueryEngine) SetShardInfo(shardId int, shardLocal bool)

Shard will call this method for EXPLAIN query

func (*QueryEngine) YieldPoint

func (self *QueryEngine) YieldPoint(seriesName *string, fieldNames []string, point *protocol.Point) (shouldContinue bool)

Returns false if the query should be stopped (either because of limit or error)

func (*QueryEngine) YieldSeries

func (self *QueryEngine) YieldSeries(seriesIncoming *protocol.Series) (shouldContinue bool)

type QueryProcessor

type QueryProcessor interface {
	// This method returns true if the query should continue. If the query should be stopped,
	// like maybe the limit was hit, it should return false
	YieldPoint(seriesName *string, columnNames []string, point *p.Point) bool
	YieldSeries(seriesIncoming *p.Series) bool
	Close()

	// Set by the shard, so EXPLAIN query can know query against which shard is being measured
	SetShardInfo(shardId int, shardLocal bool)

	// Let QueryProcessor identify itself. What if it is a spy and we can't check that?
	GetName() string
}

type ReverseStringSlice

type ReverseStringSlice []string

func (ReverseStringSlice) Len

func (self ReverseStringSlice) Len() int

func (ReverseStringSlice) Less

func (self ReverseStringSlice) Less(i, j int) bool

func (ReverseStringSlice) Swap

func (self ReverseStringSlice) Swap(i, j int)

type SeriesState

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

type StandardDeviationAggregator

type StandardDeviationAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*StandardDeviationAggregator) AggregatePoint

func (self *StandardDeviationAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*StandardDeviationAggregator) ColumnNames

func (self *StandardDeviationAggregator) ColumnNames() []string

func (*StandardDeviationAggregator) GetValues

func (self *StandardDeviationAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

type StandardDeviationRunning

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

type TopOrBottomAggregator

type TopOrBottomAggregator struct {
	AbstractAggregator
	// contains filtered or unexported fields
}

func (*TopOrBottomAggregator) AggregatePoint

func (self *TopOrBottomAggregator) AggregatePoint(state interface{}, p *protocol.Point) (interface{}, error)

func (*TopOrBottomAggregator) ColumnNames

func (self *TopOrBottomAggregator) ColumnNames() []string

func (*TopOrBottomAggregator) GetValues

func (self *TopOrBottomAggregator) GetValues(state interface{}) [][]*protocol.FieldValue

func (*TopOrBottomAggregator) InitializeFieldsMetadata

func (self *TopOrBottomAggregator) InitializeFieldsMetadata(series *protocol.Series) error

type TopOrBottomAggregatorState

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

type Trie

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

func NewTrie

func NewTrie(numLevels, numStates int) *Trie

func (*Trie) Clear

func (self *Trie) Clear()

func (*Trie) CountLeafNodes

func (self *Trie) CountLeafNodes() int

func (*Trie) GetNode

func (self *Trie) GetNode(values []*protocol.FieldValue) *Node

func (*Trie) Traverse

func (self *Trie) Traverse(f func([]*protocol.FieldValue, *Node) error) error

func (*Trie) TraverseLevel

func (self *Trie) TraverseLevel(level int, f func([]*protocol.FieldValue, *Node) error) error

Traverses all nodes at the given level, -1 to get nodes at the most bottom level

Jump to

Keyboard shortcuts

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