query

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultQueryTimeout is the default timeout for executing a query.
	// A value of zero will have no query timeout.
	DefaultQueryTimeout = time.Duration(0)
)
View Source
const DefaultStatsInterval = time.Second

DefaultStatsInterval is the default value for IteratorEncoder.StatsInterval.

View Source
const (

	// PanicCrashEnv is the environment variable that, when set, will prevent
	// the handler from recovering any panics.
	PanicCrashEnv = "INFLUXDB_PANIC_CRASH"
)

Statistics for the QueryExecutor

View Source
const (
	// WarningLevel is the message level for a warning.
	WarningLevel = "warning"
)
View Source
const ZeroTime = int64(math.MinInt64)

ZeroTime is the Unix nanosecond timestamp for no time. This time is not used by the query engine or the storage engine as a valid time.

Variables

View Source
var (
	// ErrInvalidQuery is returned when executing an unknown query type.
	ErrInvalidQuery = errors.New("invalid query")

	// ErrNotExecuted is returned when a statement is not executed in a query.
	// This can occur when a previous statement in the same query has errored.
	ErrNotExecuted = errors.New("not executed")

	// ErrQueryInterrupted is an error returned when the query is interrupted.
	ErrQueryInterrupted = errors.New("query interrupted")

	// ErrQueryAborted is an error returned when the query is aborted.
	ErrQueryAborted = errors.New("query aborted")

	// ErrQueryEngineShutdown is an error sent when the query cannot be
	// created because the query engine was shutdown.
	ErrQueryEngineShutdown = errors.New("query engine shutdown")

	// ErrQueryTimeoutLimitExceeded is an error when a query hits the max time allowed to run.
	ErrQueryTimeoutLimitExceeded = errors.New("query-timeout limit exceeded")

	// ErrAlreadyKilled is returned when attempting to kill a query that has already been killed.
	ErrAlreadyKilled = errors.New("already killed")
)
View Source
var ErrUnknownCall = errors.New("unknown call")

ErrUnknownCall is returned when operating on an unknown function call.

View Source
var OpenAuthorizer = openAuthorizer{}

OpenAuthorizer can be shared by all goroutines.

Functions

func AggregateBooleanPoints

func AggregateBooleanPoints(a BooleanPointAggregator, points []BooleanPoint)

AggregateBooleanPoints feeds a slice of BooleanPoint into an aggregator. If the aggregator is a BooleanBulkPointAggregator, it will use the AggregateBulk method.

func AggregateFloatPoints

func AggregateFloatPoints(a FloatPointAggregator, points []FloatPoint)

AggregateFloatPoints feeds a slice of FloatPoint into an aggregator. If the aggregator is a FloatBulkPointAggregator, it will use the AggregateBulk method.

func AggregateIntegerPoints

func AggregateIntegerPoints(a IntegerPointAggregator, points []IntegerPoint)

AggregateIntegerPoints feeds a slice of IntegerPoint into an aggregator. If the aggregator is a IntegerBulkPointAggregator, it will use the AggregateBulk method.

func AggregateStringPoints

func AggregateStringPoints(a StringPointAggregator, points []StringPoint)

AggregateStringPoints feeds a slice of StringPoint into an aggregator. If the aggregator is a StringBulkPointAggregator, it will use the AggregateBulk method.

func AggregateUnsignedPoints

func AggregateUnsignedPoints(a UnsignedPointAggregator, points []UnsignedPoint)

AggregateUnsignedPoints feeds a slice of UnsignedPoint into an aggregator. If the aggregator is a UnsignedBulkPointAggregator, it will use the AggregateBulk method.

func AuthorizerIsOpen added in v1.5.0

func AuthorizerIsOpen(a Authorizer) bool

AuthorizerIsOpen returns true if the provided Authorizer is guaranteed to authorize anything. A nil Authorizer returns true for this function, and this function should be preferred over directly checking if an Authorizer is nil or not.

func BooleanCountReduce

func BooleanCountReduce(prev *IntegerPoint, curr *BooleanPoint) (int64, int64, []interface{})

BooleanCountReduce returns the count of points.

func BooleanFirstReduce

func BooleanFirstReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})

BooleanFirstReduce returns the first point sorted by time.

func BooleanLastReduce

func BooleanLastReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})

BooleanLastReduce returns the first point sorted by time.

func BooleanMaxReduce

func BooleanMaxReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})

BooleanMaxReduce returns the minimum value between prev & curr.

func BooleanMinReduce

func BooleanMinReduce(prev, curr *BooleanPoint) (int64, bool, []interface{})

BooleanMinReduce returns the minimum value between prev & curr.

func DrainIterator

func DrainIterator(itr Iterator)

DrainIterator reads and discards all points from itr.

func DrainIterators

func DrainIterators(itrs []Iterator)

DrainIterators reads and discards all points from itrs.

func ErrDatabaseNotFound

func ErrDatabaseNotFound(name string) error

ErrDatabaseNotFound returns a database not found error for the given database name.

func ErrMaxConcurrentQueriesLimitExceeded

func ErrMaxConcurrentQueriesLimitExceeded(n, limit int) error

ErrMaxConcurrentQueriesLimitExceeded is an error when a query cannot be run because the maximum number of queries has been reached.

func ErrMaxSelectPointsLimitExceeded

func ErrMaxSelectPointsLimitExceeded(n, limit int) error

ErrMaxSelectPointsLimitExceeded is an error when a query hits the maximum number of points.

func FloatCountReduce

func FloatCountReduce(prev *IntegerPoint, curr *FloatPoint) (int64, int64, []interface{})

FloatCountReduce returns the count of points.

func FloatFirstReduce

func FloatFirstReduce(prev, curr *FloatPoint) (int64, float64, []interface{})

FloatFirstReduce returns the first point sorted by time.

func FloatLastReduce

func FloatLastReduce(prev, curr *FloatPoint) (int64, float64, []interface{})

FloatLastReduce returns the last point sorted by time.

func FloatMaxReduce

func FloatMaxReduce(prev, curr *FloatPoint) (int64, float64, []interface{})

FloatMaxReduce returns the maximum value between prev & curr.

func FloatMinReduce

func FloatMinReduce(prev, curr *FloatPoint) (int64, float64, []interface{})

FloatMinReduce returns the minimum value between prev & curr.

func FloatSumReduce

func FloatSumReduce(prev, curr *FloatPoint) (int64, float64, []interface{})

FloatSumReduce returns the sum prev value & curr value.

func IntegerCountReduce

func IntegerCountReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})

IntegerCountReduce returns the count of points.

func IntegerFirstReduce

func IntegerFirstReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})

IntegerFirstReduce returns the first point sorted by time.

func IntegerLastReduce

func IntegerLastReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})

IntegerLastReduce returns the last point sorted by time.

func IntegerMaxReduce

func IntegerMaxReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})

IntegerMaxReduce returns the maximum value between prev & curr.

func IntegerMinReduce

func IntegerMinReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})

IntegerMinReduce returns the minimum value between prev & curr.

func IntegerSumReduce

func IntegerSumReduce(prev, curr *IntegerPoint) (int64, int64, []interface{})

IntegerSumReduce returns the sum prev value & curr value.

func NewContextWithIterators

func NewContextWithIterators(ctx context.Context, itr *Iterators) context.Context

NewContextWithIterators returns a new context.Context with the *Iterators slice added. The query planner will add instances of AuxIterator to the Iterators slice.

func RewriteStatement

func RewriteStatement(stmt influxql.Statement) (influxql.Statement, error)

RewriteStatement rewrites stmt into a new statement, if applicable.

func StringCountReduce

func StringCountReduce(prev *IntegerPoint, curr *StringPoint) (int64, int64, []interface{})

StringCountReduce returns the count of points.

func StringFirstReduce

func StringFirstReduce(prev, curr *StringPoint) (int64, string, []interface{})

StringFirstReduce returns the first point sorted by time.

func StringLastReduce

func StringLastReduce(prev, curr *StringPoint) (int64, string, []interface{})

StringLastReduce returns the first point sorted by time.

func UnsignedCountReduce

func UnsignedCountReduce(prev *IntegerPoint, curr *UnsignedPoint) (int64, int64, []interface{})

UnsignedCountReduce returns the count of points.

func UnsignedFirstReduce

func UnsignedFirstReduce(prev, curr *UnsignedPoint) (int64, uint64, []interface{})

UnsignedFirstReduce returns the first point sorted by time.

func UnsignedLastReduce

func UnsignedLastReduce(prev, curr *UnsignedPoint) (int64, uint64, []interface{})

UnsignedLastReduce returns the last point sorted by time.

func UnsignedMaxReduce

func UnsignedMaxReduce(prev, curr *UnsignedPoint) (int64, uint64, []interface{})

UnsignedMaxReduce returns the maximum value between prev & curr.

func UnsignedMinReduce

func UnsignedMinReduce(prev, curr *UnsignedPoint) (int64, uint64, []interface{})

UnsignedMinReduce returns the minimum value between prev & curr.

func UnsignedSumReduce

func UnsignedSumReduce(prev, curr *UnsignedPoint) (int64, uint64, []interface{})

UnsignedSumReduce returns the sum prev value & curr value.

Types

type Authorizer

type Authorizer interface {
	// AuthorizeDatabase indicates whether the given Privilege is authorized on the database with the given name.
	AuthorizeDatabase(p influxql.Privilege, name string) bool

	// AuthorizeQuery returns an error if the query cannot be executed
	AuthorizeQuery(database string, query *influxql.Query) error

	// AuthorizeSeriesRead determines if a series is authorized for reading
	AuthorizeSeriesRead(database string, measurement []byte, tags models.Tags) bool

	// AuthorizeSeriesWrite determines if a series is authorized for writing
	AuthorizeSeriesWrite(database string, measurement []byte, tags models.Tags) bool
}

Authorizer determines if certain operations are authorized.

type AuxIterator

type AuxIterator interface {
	Iterator

	// Auxilary iterator
	Iterator(name string, typ influxql.DataType) Iterator

	// Start starts writing to the created iterators.
	Start()

	// Backgrounds the iterator so that, when start is called, it will
	// continuously read from the iterator.
	Background()
}

AuxIterator represents an iterator that can split off separate auxiliary iterators.

func NewAuxIterator

func NewAuxIterator(input Iterator, opt IteratorOptions) AuxIterator

NewAuxIterator returns a new instance of AuxIterator.

type BooleanBulkPointAggregator

type BooleanBulkPointAggregator interface {
	AggregateBooleanBulk(points []BooleanPoint)
}

BooleanBulkPointAggregator aggregates multiple points at a time.

type BooleanDistinctReducer

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

BooleanDistinctReducer returns the distinct points in a series.

func NewBooleanDistinctReducer

func NewBooleanDistinctReducer() *BooleanDistinctReducer

NewBooleanDistinctReducer creates a new BooleanDistinctReducer.

func (*BooleanDistinctReducer) AggregateBoolean

func (r *BooleanDistinctReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean aggregates a point into the reducer.

func (*BooleanDistinctReducer) Emit

Emit emits the distinct points that have been aggregated into the reducer.

type BooleanElapsedReducer

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

BooleanElapsedReducer calculates the elapsed of the aggregated points.

func NewBooleanElapsedReducer

func NewBooleanElapsedReducer(interval Interval) *BooleanElapsedReducer

NewBooleanElapsedReducer creates a new BooleanElapsedReducer.

func (*BooleanElapsedReducer) AggregateBoolean

func (r *BooleanElapsedReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean aggregates a point into the reducer and updates the current window.

func (*BooleanElapsedReducer) Emit

func (r *BooleanElapsedReducer) Emit() []IntegerPoint

Emit emits the elapsed of the reducer at the current point.

type BooleanFuncFloatReducer

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

BooleanFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewBooleanFuncFloatReducer

func NewBooleanFuncFloatReducer(fn BooleanReduceFloatFunc, prev *FloatPoint) *BooleanFuncFloatReducer

NewBooleanFuncFloatReducer creates a new BooleanFuncFloatReducer.

func (*BooleanFuncFloatReducer) AggregateBoolean

func (r *BooleanFuncFloatReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.

func (*BooleanFuncFloatReducer) Emit

func (r *BooleanFuncFloatReducer) Emit() []FloatPoint

Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.

type BooleanFuncIntegerReducer

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

BooleanFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewBooleanFuncIntegerReducer

func NewBooleanFuncIntegerReducer(fn BooleanReduceIntegerFunc, prev *IntegerPoint) *BooleanFuncIntegerReducer

NewBooleanFuncIntegerReducer creates a new BooleanFuncIntegerReducer.

func (*BooleanFuncIntegerReducer) AggregateBoolean

func (r *BooleanFuncIntegerReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.

func (*BooleanFuncIntegerReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.

type BooleanFuncReducer

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

BooleanFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewBooleanFuncReducer

func NewBooleanFuncReducer(fn BooleanReduceFunc, prev *BooleanPoint) *BooleanFuncReducer

NewBooleanFuncReducer creates a new BooleanFuncBooleanReducer.

func (*BooleanFuncReducer) AggregateBoolean

func (r *BooleanFuncReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.

func (*BooleanFuncReducer) Emit

func (r *BooleanFuncReducer) Emit() []BooleanPoint

Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.

type BooleanFuncStringReducer

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

BooleanFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewBooleanFuncStringReducer

func NewBooleanFuncStringReducer(fn BooleanReduceStringFunc, prev *StringPoint) *BooleanFuncStringReducer

NewBooleanFuncStringReducer creates a new BooleanFuncStringReducer.

func (*BooleanFuncStringReducer) AggregateBoolean

func (r *BooleanFuncStringReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.

func (*BooleanFuncStringReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.

type BooleanFuncUnsignedReducer

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

BooleanFuncUnsignedReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewBooleanFuncUnsignedReducer

func NewBooleanFuncUnsignedReducer(fn BooleanReduceUnsignedFunc, prev *UnsignedPoint) *BooleanFuncUnsignedReducer

NewBooleanFuncUnsignedReducer creates a new BooleanFuncUnsignedReducer.

func (*BooleanFuncUnsignedReducer) AggregateBoolean

func (r *BooleanFuncUnsignedReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean takes a BooleanPoint and invokes the reduce function with the current and new point to modify the current point.

func (*BooleanFuncUnsignedReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateBoolean.

type BooleanIterator

type BooleanIterator interface {
	Iterator
	Next() (*BooleanPoint, error)
}

BooleanIterator represents a stream of boolean points.

type BooleanPoint

type BooleanPoint struct {
	Name string
	Tags Tags

	Time  int64
	Value bool
	Aux   []interface{}

	// Total number of points that were combined into this point from an aggregate.
	// If this is zero, the point is not the result of an aggregate function.
	Aggregated uint32
	Nil        bool
}

BooleanPoint represents a point with a bool value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.

func BooleanModeReduceSlice

func BooleanModeReduceSlice(a []BooleanPoint) []BooleanPoint

BooleanModeReduceSlice returns the mode value within a window.

func (*BooleanPoint) Clone

func (v *BooleanPoint) Clone() *BooleanPoint

Clone returns a copy of v.

func (*BooleanPoint) CopyTo

func (v *BooleanPoint) CopyTo(other *BooleanPoint)

CopyTo makes a deep copy into the point.

type BooleanPointAggregator

type BooleanPointAggregator interface {
	AggregateBoolean(p *BooleanPoint)
}

BooleanPointAggregator aggregates points to produce a single point.

type BooleanPointDecoder

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

BooleanPointDecoder decodes BooleanPoint points from a reader.

func NewBooleanPointDecoder

func NewBooleanPointDecoder(ctx context.Context, r io.Reader) *BooleanPointDecoder

NewBooleanPointDecoder returns a new instance of BooleanPointDecoder that reads from r.

func (*BooleanPointDecoder) DecodeBooleanPoint

func (dec *BooleanPointDecoder) DecodeBooleanPoint(p *BooleanPoint) error

DecodeBooleanPoint reads from the underlying reader and unmarshals into p.

func (*BooleanPointDecoder) Stats

func (dec *BooleanPointDecoder) Stats() IteratorStats

Stats returns iterator stats embedded within the stream.

type BooleanPointEmitter

type BooleanPointEmitter interface {
	Emit() []BooleanPoint
}

BooleanPointEmitter produces a single point from an aggregate.

type BooleanPointEncoder

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

BooleanPointEncoder encodes BooleanPoint points to a writer.

func NewBooleanPointEncoder

func NewBooleanPointEncoder(w io.Writer) *BooleanPointEncoder

NewBooleanPointEncoder returns a new instance of BooleanPointEncoder that writes to w.

func (*BooleanPointEncoder) EncodeBooleanPoint

func (enc *BooleanPointEncoder) EncodeBooleanPoint(p *BooleanPoint) error

EncodeBooleanPoint marshals and writes p to the underlying writer.

type BooleanReduceFloatFunc

type BooleanReduceFloatFunc func(prev *FloatPoint, curr *BooleanPoint) (t int64, v float64, aux []interface{})

BooleanReduceFloatFunc is the function called by a BooleanPoint reducer.

type BooleanReduceFloatSliceFunc

type BooleanReduceFloatSliceFunc func(a []BooleanPoint) []FloatPoint

BooleanReduceFloatSliceFunc is the function called by a BooleanPoint reducer.

type BooleanReduceFunc

type BooleanReduceFunc func(prev *BooleanPoint, curr *BooleanPoint) (t int64, v bool, aux []interface{})

BooleanReduceFunc is the function called by a BooleanPoint reducer.

type BooleanReduceIntegerFunc

type BooleanReduceIntegerFunc func(prev *IntegerPoint, curr *BooleanPoint) (t int64, v int64, aux []interface{})

BooleanReduceIntegerFunc is the function called by a BooleanPoint reducer.

type BooleanReduceIntegerSliceFunc

type BooleanReduceIntegerSliceFunc func(a []BooleanPoint) []IntegerPoint

BooleanReduceIntegerSliceFunc is the function called by a BooleanPoint reducer.

type BooleanReduceSliceFunc

type BooleanReduceSliceFunc func(a []BooleanPoint) []BooleanPoint

BooleanReduceSliceFunc is the function called by a BooleanPoint reducer.

type BooleanReduceStringFunc

type BooleanReduceStringFunc func(prev *StringPoint, curr *BooleanPoint) (t int64, v string, aux []interface{})

BooleanReduceStringFunc is the function called by a BooleanPoint reducer.

type BooleanReduceStringSliceFunc

type BooleanReduceStringSliceFunc func(a []BooleanPoint) []StringPoint

BooleanReduceStringSliceFunc is the function called by a BooleanPoint reducer.

type BooleanReduceUnsignedFunc

type BooleanReduceUnsignedFunc func(prev *UnsignedPoint, curr *BooleanPoint) (t int64, v uint64, aux []interface{})

BooleanReduceUnsignedFunc is the function called by a BooleanPoint reducer.

type BooleanReduceUnsignedSliceFunc

type BooleanReduceUnsignedSliceFunc func(a []BooleanPoint) []UnsignedPoint

BooleanReduceUnsignedSliceFunc is the function called by a BooleanPoint reducer.

type BooleanSampleReducer

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

BooleanSampleReducer implements a reservoir sampling to calculate a random subset of points

func NewBooleanSampleReducer

func NewBooleanSampleReducer(size int) *BooleanSampleReducer

NewBooleanSampleReducer creates a new BooleanSampleReducer

func (*BooleanSampleReducer) AggregateBoolean

func (r *BooleanSampleReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean aggregates a point into the reducer.

func (*BooleanSampleReducer) Emit

func (r *BooleanSampleReducer) Emit() []BooleanPoint

Emit emits the reservoir sample as many points.

type BooleanSliceFuncFloatReducer

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

BooleanSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewBooleanSliceFuncFloatReducer

func NewBooleanSliceFuncFloatReducer(fn BooleanReduceFloatSliceFunc) *BooleanSliceFuncFloatReducer

NewBooleanSliceFuncFloatReducer creates a new BooleanSliceFuncFloatReducer.

func (*BooleanSliceFuncFloatReducer) AggregateBoolean

func (r *BooleanSliceFuncFloatReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*BooleanSliceFuncFloatReducer) AggregateBooleanBulk

func (r *BooleanSliceFuncFloatReducer) AggregateBooleanBulk(points []BooleanPoint)

AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.

func (*BooleanSliceFuncFloatReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type BooleanSliceFuncIntegerReducer

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

BooleanSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewBooleanSliceFuncIntegerReducer

func NewBooleanSliceFuncIntegerReducer(fn BooleanReduceIntegerSliceFunc) *BooleanSliceFuncIntegerReducer

NewBooleanSliceFuncIntegerReducer creates a new BooleanSliceFuncIntegerReducer.

func (*BooleanSliceFuncIntegerReducer) AggregateBoolean

func (r *BooleanSliceFuncIntegerReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*BooleanSliceFuncIntegerReducer) AggregateBooleanBulk

func (r *BooleanSliceFuncIntegerReducer) AggregateBooleanBulk(points []BooleanPoint)

AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.

func (*BooleanSliceFuncIntegerReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type BooleanSliceFuncReducer

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

BooleanSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewBooleanSliceFuncReducer

func NewBooleanSliceFuncReducer(fn BooleanReduceSliceFunc) *BooleanSliceFuncReducer

NewBooleanSliceFuncReducer creates a new BooleanSliceFuncReducer.

func (*BooleanSliceFuncReducer) AggregateBoolean

func (r *BooleanSliceFuncReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*BooleanSliceFuncReducer) AggregateBooleanBulk

func (r *BooleanSliceFuncReducer) AggregateBooleanBulk(points []BooleanPoint)

AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.

func (*BooleanSliceFuncReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type BooleanSliceFuncStringReducer

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

BooleanSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewBooleanSliceFuncStringReducer

func NewBooleanSliceFuncStringReducer(fn BooleanReduceStringSliceFunc) *BooleanSliceFuncStringReducer

NewBooleanSliceFuncStringReducer creates a new BooleanSliceFuncStringReducer.

func (*BooleanSliceFuncStringReducer) AggregateBoolean

func (r *BooleanSliceFuncStringReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*BooleanSliceFuncStringReducer) AggregateBooleanBulk

func (r *BooleanSliceFuncStringReducer) AggregateBooleanBulk(points []BooleanPoint)

AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.

func (*BooleanSliceFuncStringReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type BooleanSliceFuncUnsignedReducer

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

BooleanSliceFuncUnsignedReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewBooleanSliceFuncUnsignedReducer

func NewBooleanSliceFuncUnsignedReducer(fn BooleanReduceUnsignedSliceFunc) *BooleanSliceFuncUnsignedReducer

NewBooleanSliceFuncUnsignedReducer creates a new BooleanSliceFuncUnsignedReducer.

func (*BooleanSliceFuncUnsignedReducer) AggregateBoolean

func (r *BooleanSliceFuncUnsignedReducer) AggregateBoolean(p *BooleanPoint)

AggregateBoolean copies the BooleanPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*BooleanSliceFuncUnsignedReducer) AggregateBooleanBulk

func (r *BooleanSliceFuncUnsignedReducer) AggregateBooleanBulk(points []BooleanPoint)

AggregateBooleanBulk performs a bulk copy of BooleanPoints into the internal slice. This is a more efficient version of calling AggregateBoolean on each point.

func (*BooleanSliceFuncUnsignedReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type CompileOptions

type CompileOptions struct {
	Now time.Time
}

CompileOptions are the customization options for the compiler.

type Emitter

type Emitter struct {

	// The columns to attach to each row.
	Columns []string

	// Overridden measurement name to emit.
	EmitName string

	// The time zone location.
	Location *time.Location

	// Removes the "time" column from output.
	// Used for meta queries where time does not apply.
	OmitTime bool
	// contains filtered or unexported fields
}

Emitter groups values together by name, tags, and time.

func NewEmitter

func NewEmitter(itrs []Iterator, ascending bool, chunkSize int) *Emitter

NewEmitter returns a new instance of Emitter that pulls from itrs.

func (*Emitter) Close

func (e *Emitter) Close() error

Close closes the underlying iterators.

func (*Emitter) Emit

func (e *Emitter) Emit() (*models.Row, bool, error)

Emit returns the next row from the iterators.

type ExecutionContext

type ExecutionContext struct {
	// The statement ID of the executing query.
	StatementID int

	// The query ID of the executing query.
	QueryID uint64

	// The query task information available to the StatementExecutor.
	Query *QueryTask

	// Output channel where results and errors should be sent.
	Results chan *Result

	// A channel that is closed when the query is interrupted.
	InterruptCh <-chan struct{}

	// Options used to start this query.
	ExecutionOptions
}

ExecutionContext contains state that the query is currently executing with.

func (*ExecutionContext) Send

func (ctx *ExecutionContext) Send(result *Result) error

Send sends a Result to the Results channel and will exit if the query has been interrupted or aborted.

type ExecutionOptions

type ExecutionOptions struct {
	// The database the query is running against.
	Database string

	// How to determine whether the query is allowed to execute,
	// what resources can be returned in SHOW queries, etc.
	Authorizer Authorizer

	// The requested maximum number of points to return in each result.
	ChunkSize int

	// If this query is being executed in a read-only context.
	ReadOnly bool

	// Node to execute on.
	NodeID uint64

	// Quiet suppresses non-essential output from the query executor.
	Quiet bool

	// AbortCh is a channel that signals when results are no longer desired by the caller.
	AbortCh <-chan struct{}
}

ExecutionOptions contains the options for executing a query.

type FieldMap

type FieldMap int

func (FieldMap) Value

func (i FieldMap) Value(tags Tags, buf []interface{}) interface{}

type FloatBottomReducer

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

func NewFloatBottomReducer

func NewFloatBottomReducer(n int) *FloatBottomReducer

func (*FloatBottomReducer) AggregateFloat

func (r *FloatBottomReducer) AggregateFloat(p *FloatPoint)

func (*FloatBottomReducer) Emit

func (r *FloatBottomReducer) Emit() []FloatPoint

type FloatBulkPointAggregator

type FloatBulkPointAggregator interface {
	AggregateFloatBulk(points []FloatPoint)
}

FloatBulkPointAggregator aggregates multiple points at a time.

type FloatCumulativeSumReducer

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

FloatCumulativeSumReducer cumulates the values from each point.

func NewFloatCumulativeSumReducer

func NewFloatCumulativeSumReducer() *FloatCumulativeSumReducer

NewFloatCumulativeSumReducer creates a new FloatCumulativeSumReducer.

func (*FloatCumulativeSumReducer) AggregateFloat

func (r *FloatCumulativeSumReducer) AggregateFloat(p *FloatPoint)

func (*FloatCumulativeSumReducer) Emit

type FloatDerivativeReducer

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

FloatDerivativeReducer calculates the derivative of the aggregated points.

func NewFloatDerivativeReducer

func NewFloatDerivativeReducer(interval Interval, isNonNegative, ascending bool) *FloatDerivativeReducer

NewFloatDerivativeReducer creates a new FloatDerivativeReducer.

func (*FloatDerivativeReducer) AggregateFloat

func (r *FloatDerivativeReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer and updates the current window.

func (*FloatDerivativeReducer) Emit

func (r *FloatDerivativeReducer) Emit() []FloatPoint

Emit emits the derivative of the reducer at the current point.

type FloatDifferenceReducer

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

FloatDifferenceReducer calculates the derivative of the aggregated points.

func NewFloatDifferenceReducer

func NewFloatDifferenceReducer(isNonNegative bool) *FloatDifferenceReducer

NewFloatDifferenceReducer creates a new FloatDifferenceReducer.

func (*FloatDifferenceReducer) AggregateFloat

func (r *FloatDifferenceReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer and updates the current window.

func (*FloatDifferenceReducer) Emit

func (r *FloatDifferenceReducer) Emit() []FloatPoint

Emit emits the difference of the reducer at the current point.

type FloatDistinctReducer

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

FloatDistinctReducer returns the distinct points in a series.

func NewFloatDistinctReducer

func NewFloatDistinctReducer() *FloatDistinctReducer

NewFloatDistinctReducer creates a new FloatDistinctReducer.

func (*FloatDistinctReducer) AggregateFloat

func (r *FloatDistinctReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer.

func (*FloatDistinctReducer) Emit

func (r *FloatDistinctReducer) Emit() []FloatPoint

Emit emits the distinct points that have been aggregated into the reducer.

type FloatElapsedReducer

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

FloatElapsedReducer calculates the elapsed of the aggregated points.

func NewFloatElapsedReducer

func NewFloatElapsedReducer(interval Interval) *FloatElapsedReducer

NewFloatElapsedReducer creates a new FloatElapsedReducer.

func (*FloatElapsedReducer) AggregateFloat

func (r *FloatElapsedReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer and updates the current window.

func (*FloatElapsedReducer) Emit

func (r *FloatElapsedReducer) Emit() []IntegerPoint

Emit emits the elapsed of the reducer at the current point.

type FloatFuncBooleanReducer

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

FloatFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewFloatFuncBooleanReducer

func NewFloatFuncBooleanReducer(fn FloatReduceBooleanFunc, prev *BooleanPoint) *FloatFuncBooleanReducer

NewFloatFuncBooleanReducer creates a new FloatFuncBooleanReducer.

func (*FloatFuncBooleanReducer) AggregateFloat

func (r *FloatFuncBooleanReducer) AggregateFloat(p *FloatPoint)

AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.

func (*FloatFuncBooleanReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateFloat.

type FloatFuncIntegerReducer

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

FloatFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewFloatFuncIntegerReducer

func NewFloatFuncIntegerReducer(fn FloatReduceIntegerFunc, prev *IntegerPoint) *FloatFuncIntegerReducer

NewFloatFuncIntegerReducer creates a new FloatFuncIntegerReducer.

func (*FloatFuncIntegerReducer) AggregateFloat

func (r *FloatFuncIntegerReducer) AggregateFloat(p *FloatPoint)

AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.

func (*FloatFuncIntegerReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateFloat.

type FloatFuncReducer

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

FloatFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewFloatFuncReducer

func NewFloatFuncReducer(fn FloatReduceFunc, prev *FloatPoint) *FloatFuncReducer

NewFloatFuncReducer creates a new FloatFuncFloatReducer.

func (*FloatFuncReducer) AggregateFloat

func (r *FloatFuncReducer) AggregateFloat(p *FloatPoint)

AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.

func (*FloatFuncReducer) Emit

func (r *FloatFuncReducer) Emit() []FloatPoint

Emit emits the point that was generated when reducing the points fed in with AggregateFloat.

type FloatFuncStringReducer

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

FloatFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewFloatFuncStringReducer

func NewFloatFuncStringReducer(fn FloatReduceStringFunc, prev *StringPoint) *FloatFuncStringReducer

NewFloatFuncStringReducer creates a new FloatFuncStringReducer.

func (*FloatFuncStringReducer) AggregateFloat

func (r *FloatFuncStringReducer) AggregateFloat(p *FloatPoint)

AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.

func (*FloatFuncStringReducer) Emit

func (r *FloatFuncStringReducer) Emit() []StringPoint

Emit emits the point that was generated when reducing the points fed in with AggregateFloat.

type FloatFuncUnsignedReducer

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

FloatFuncUnsignedReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewFloatFuncUnsignedReducer

func NewFloatFuncUnsignedReducer(fn FloatReduceUnsignedFunc, prev *UnsignedPoint) *FloatFuncUnsignedReducer

NewFloatFuncUnsignedReducer creates a new FloatFuncUnsignedReducer.

func (*FloatFuncUnsignedReducer) AggregateFloat

func (r *FloatFuncUnsignedReducer) AggregateFloat(p *FloatPoint)

AggregateFloat takes a FloatPoint and invokes the reduce function with the current and new point to modify the current point.

func (*FloatFuncUnsignedReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateFloat.

type FloatHoltWintersReducer

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

FloatHoltWintersReducer forecasts a series into the future. This is done using the Holt-Winters damped method.

  1. Using the series the initial values are calculated using a SSE.
  2. The series is forecasted into the future using the iterative relations.

func NewFloatHoltWintersReducer

func NewFloatHoltWintersReducer(h, m int, includeFitData bool, interval time.Duration) *FloatHoltWintersReducer

NewFloatHoltWintersReducer creates a new FloatHoltWintersReducer.

func (*FloatHoltWintersReducer) AggregateFloat

func (r *FloatHoltWintersReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer and updates the current window.

func (*FloatHoltWintersReducer) AggregateInteger

func (r *FloatHoltWintersReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer and updates the current window.

func (*FloatHoltWintersReducer) Emit

func (r *FloatHoltWintersReducer) Emit() []FloatPoint

Emit returns the points generated by the HoltWinters algorithm.

type FloatIntegralReducer

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

FloatIntegralReducer calculates the time-integral of the aggregated points.

func NewFloatIntegralReducer

func NewFloatIntegralReducer(interval Interval, opt IteratorOptions) *FloatIntegralReducer

NewFloatIntegralReducer creates a new FloatIntegralReducer.

func (*FloatIntegralReducer) AggregateFloat

func (r *FloatIntegralReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer.

func (*FloatIntegralReducer) Close

func (r *FloatIntegralReducer) Close() error

Close flushes any in progress points to ensure any remaining points are emitted.

func (*FloatIntegralReducer) Emit

func (r *FloatIntegralReducer) Emit() []FloatPoint

Emit emits the time-integral of the aggregated points as a single point. InfluxQL convention dictates that outside a group-by-time clause we return a timestamp of zero. Within a group-by-time, we can set the time to ZeroTime and a higher level will change it to the start of the time group.

type FloatIterator

type FloatIterator interface {
	Iterator
	Next() (*FloatPoint, error)
}

FloatIterator represents a stream of float points.

type FloatMeanReducer

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

FloatMeanReducer calculates the mean of the aggregated points.

func NewFloatMeanReducer

func NewFloatMeanReducer() *FloatMeanReducer

NewFloatMeanReducer creates a new FloatMeanReducer.

func (*FloatMeanReducer) AggregateFloat

func (r *FloatMeanReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer.

func (*FloatMeanReducer) Emit

func (r *FloatMeanReducer) Emit() []FloatPoint

Emit emits the mean of the aggregated points as a single point.

type FloatMovingAverageReducer

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

FloatMovingAverageReducer calculates the moving average of the aggregated points.

func NewFloatMovingAverageReducer

func NewFloatMovingAverageReducer(n int) *FloatMovingAverageReducer

NewFloatMovingAverageReducer creates a new FloatMovingAverageReducer.

func (*FloatMovingAverageReducer) AggregateFloat

func (r *FloatMovingAverageReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer and updates the current window.

func (*FloatMovingAverageReducer) Emit

Emit emits the moving average of the current window. Emit should be called after every call to AggregateFloat and it will produce one point if there is enough data to fill a window, otherwise it will produce zero points.

type FloatPoint

type FloatPoint struct {
	Name string
	Tags Tags

	Time  int64
	Value float64
	Aux   []interface{}

	// Total number of points that were combined into this point from an aggregate.
	// If this is zero, the point is not the result of an aggregate function.
	Aggregated uint32
	Nil        bool
}

FloatPoint represents a point with a float64 value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.

func FloatMedianReduceSlice

func FloatMedianReduceSlice(a []FloatPoint) []FloatPoint

FloatMedianReduceSlice returns the median value within a window.

func FloatModeReduceSlice

func FloatModeReduceSlice(a []FloatPoint) []FloatPoint

FloatModeReduceSlice returns the mode value within a window.

func FloatSpreadReduceSlice

func FloatSpreadReduceSlice(a []FloatPoint) []FloatPoint

FloatSpreadReduceSlice returns the spread value within a window.

func FloatStddevReduceSlice

func FloatStddevReduceSlice(a []FloatPoint) []FloatPoint

FloatStddevReduceSlice returns the stddev value within a window.

func IntegerMedianReduceSlice

func IntegerMedianReduceSlice(a []IntegerPoint) []FloatPoint

IntegerMedianReduceSlice returns the median value within a window.

func IntegerStddevReduceSlice

func IntegerStddevReduceSlice(a []IntegerPoint) []FloatPoint

IntegerStddevReduceSlice returns the stddev value within a window.

func UnsignedMedianReduceSlice

func UnsignedMedianReduceSlice(a []UnsignedPoint) []FloatPoint

UnsignedMedianReduceSlice returns the median value within a window.

func UnsignedStddevReduceSlice

func UnsignedStddevReduceSlice(a []UnsignedPoint) []FloatPoint

UnsignedStddevReduceSlice returns the stddev value within a window.

func (*FloatPoint) Clone

func (v *FloatPoint) Clone() *FloatPoint

Clone returns a copy of v.

func (*FloatPoint) CopyTo

func (v *FloatPoint) CopyTo(other *FloatPoint)

CopyTo makes a deep copy into the point.

type FloatPointAggregator

type FloatPointAggregator interface {
	AggregateFloat(p *FloatPoint)
}

FloatPointAggregator aggregates points to produce a single point.

type FloatPointDecoder

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

FloatPointDecoder decodes FloatPoint points from a reader.

func NewFloatPointDecoder

func NewFloatPointDecoder(ctx context.Context, r io.Reader) *FloatPointDecoder

NewFloatPointDecoder returns a new instance of FloatPointDecoder that reads from r.

func (*FloatPointDecoder) DecodeFloatPoint

func (dec *FloatPointDecoder) DecodeFloatPoint(p *FloatPoint) error

DecodeFloatPoint reads from the underlying reader and unmarshals into p.

func (*FloatPointDecoder) Stats

func (dec *FloatPointDecoder) Stats() IteratorStats

Stats returns iterator stats embedded within the stream.

type FloatPointEmitter

type FloatPointEmitter interface {
	Emit() []FloatPoint
}

FloatPointEmitter produces a single point from an aggregate.

type FloatPointEncoder

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

FloatPointEncoder encodes FloatPoint points to a writer.

func NewFloatPointEncoder

func NewFloatPointEncoder(w io.Writer) *FloatPointEncoder

NewFloatPointEncoder returns a new instance of FloatPointEncoder that writes to w.

func (*FloatPointEncoder) EncodeFloatPoint

func (enc *FloatPointEncoder) EncodeFloatPoint(p *FloatPoint) error

EncodeFloatPoint marshals and writes p to the underlying writer.

type FloatReduceBooleanFunc

type FloatReduceBooleanFunc func(prev *BooleanPoint, curr *FloatPoint) (t int64, v bool, aux []interface{})

FloatReduceBooleanFunc is the function called by a FloatPoint reducer.

type FloatReduceBooleanSliceFunc

type FloatReduceBooleanSliceFunc func(a []FloatPoint) []BooleanPoint

FloatReduceBooleanSliceFunc is the function called by a FloatPoint reducer.

type FloatReduceFunc

type FloatReduceFunc func(prev *FloatPoint, curr *FloatPoint) (t int64, v float64, aux []interface{})

FloatReduceFunc is the function called by a FloatPoint reducer.

type FloatReduceIntegerFunc

type FloatReduceIntegerFunc func(prev *IntegerPoint, curr *FloatPoint) (t int64, v int64, aux []interface{})

FloatReduceIntegerFunc is the function called by a FloatPoint reducer.

type FloatReduceIntegerSliceFunc

type FloatReduceIntegerSliceFunc func(a []FloatPoint) []IntegerPoint

FloatReduceIntegerSliceFunc is the function called by a FloatPoint reducer.

type FloatReduceSliceFunc

type FloatReduceSliceFunc func(a []FloatPoint) []FloatPoint

FloatReduceSliceFunc is the function called by a FloatPoint reducer.

func NewFloatPercentileReduceSliceFunc

func NewFloatPercentileReduceSliceFunc(percentile float64) FloatReduceSliceFunc

NewFloatPercentileReduceSliceFunc returns the percentile value within a window.

type FloatReduceStringFunc

type FloatReduceStringFunc func(prev *StringPoint, curr *FloatPoint) (t int64, v string, aux []interface{})

FloatReduceStringFunc is the function called by a FloatPoint reducer.

type FloatReduceStringSliceFunc

type FloatReduceStringSliceFunc func(a []FloatPoint) []StringPoint

FloatReduceStringSliceFunc is the function called by a FloatPoint reducer.

type FloatReduceUnsignedFunc

type FloatReduceUnsignedFunc func(prev *UnsignedPoint, curr *FloatPoint) (t int64, v uint64, aux []interface{})

FloatReduceUnsignedFunc is the function called by a FloatPoint reducer.

type FloatReduceUnsignedSliceFunc

type FloatReduceUnsignedSliceFunc func(a []FloatPoint) []UnsignedPoint

FloatReduceUnsignedSliceFunc is the function called by a FloatPoint reducer.

type FloatSampleReducer

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

FloatSampleReducer implements a reservoir sampling to calculate a random subset of points

func NewFloatSampleReducer

func NewFloatSampleReducer(size int) *FloatSampleReducer

NewFloatSampleReducer creates a new FloatSampleReducer

func (*FloatSampleReducer) AggregateFloat

func (r *FloatSampleReducer) AggregateFloat(p *FloatPoint)

AggregateFloat aggregates a point into the reducer.

func (*FloatSampleReducer) Emit

func (r *FloatSampleReducer) Emit() []FloatPoint

Emit emits the reservoir sample as many points.

type FloatSliceFuncBooleanReducer

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

FloatSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewFloatSliceFuncBooleanReducer

func NewFloatSliceFuncBooleanReducer(fn FloatReduceBooleanSliceFunc) *FloatSliceFuncBooleanReducer

NewFloatSliceFuncBooleanReducer creates a new FloatSliceFuncBooleanReducer.

func (*FloatSliceFuncBooleanReducer) AggregateFloat

func (r *FloatSliceFuncBooleanReducer) AggregateFloat(p *FloatPoint)

AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*FloatSliceFuncBooleanReducer) AggregateFloatBulk

func (r *FloatSliceFuncBooleanReducer) AggregateFloatBulk(points []FloatPoint)

AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.

func (*FloatSliceFuncBooleanReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type FloatSliceFuncIntegerReducer

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

FloatSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewFloatSliceFuncIntegerReducer

func NewFloatSliceFuncIntegerReducer(fn FloatReduceIntegerSliceFunc) *FloatSliceFuncIntegerReducer

NewFloatSliceFuncIntegerReducer creates a new FloatSliceFuncIntegerReducer.

func (*FloatSliceFuncIntegerReducer) AggregateFloat

func (r *FloatSliceFuncIntegerReducer) AggregateFloat(p *FloatPoint)

AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*FloatSliceFuncIntegerReducer) AggregateFloatBulk

func (r *FloatSliceFuncIntegerReducer) AggregateFloatBulk(points []FloatPoint)

AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.

func (*FloatSliceFuncIntegerReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type FloatSliceFuncReducer

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

FloatSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewFloatSliceFuncReducer

func NewFloatSliceFuncReducer(fn FloatReduceSliceFunc) *FloatSliceFuncReducer

NewFloatSliceFuncReducer creates a new FloatSliceFuncReducer.

func (*FloatSliceFuncReducer) AggregateFloat

func (r *FloatSliceFuncReducer) AggregateFloat(p *FloatPoint)

AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*FloatSliceFuncReducer) AggregateFloatBulk

func (r *FloatSliceFuncReducer) AggregateFloatBulk(points []FloatPoint)

AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.

func (*FloatSliceFuncReducer) Emit

func (r *FloatSliceFuncReducer) Emit() []FloatPoint

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type FloatSliceFuncStringReducer

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

FloatSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewFloatSliceFuncStringReducer

func NewFloatSliceFuncStringReducer(fn FloatReduceStringSliceFunc) *FloatSliceFuncStringReducer

NewFloatSliceFuncStringReducer creates a new FloatSliceFuncStringReducer.

func (*FloatSliceFuncStringReducer) AggregateFloat

func (r *FloatSliceFuncStringReducer) AggregateFloat(p *FloatPoint)

AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*FloatSliceFuncStringReducer) AggregateFloatBulk

func (r *FloatSliceFuncStringReducer) AggregateFloatBulk(points []FloatPoint)

AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.

func (*FloatSliceFuncStringReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type FloatSliceFuncUnsignedReducer

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

FloatSliceFuncUnsignedReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewFloatSliceFuncUnsignedReducer

func NewFloatSliceFuncUnsignedReducer(fn FloatReduceUnsignedSliceFunc) *FloatSliceFuncUnsignedReducer

NewFloatSliceFuncUnsignedReducer creates a new FloatSliceFuncUnsignedReducer.

func (*FloatSliceFuncUnsignedReducer) AggregateFloat

func (r *FloatSliceFuncUnsignedReducer) AggregateFloat(p *FloatPoint)

AggregateFloat copies the FloatPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*FloatSliceFuncUnsignedReducer) AggregateFloatBulk

func (r *FloatSliceFuncUnsignedReducer) AggregateFloatBulk(points []FloatPoint)

AggregateFloatBulk performs a bulk copy of FloatPoints into the internal slice. This is a more efficient version of calling AggregateFloat on each point.

func (*FloatSliceFuncUnsignedReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type FloatTopReducer

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

func NewFloatTopReducer

func NewFloatTopReducer(n int) *FloatTopReducer

func (*FloatTopReducer) AggregateFloat

func (r *FloatTopReducer) AggregateFloat(p *FloatPoint)

func (*FloatTopReducer) Emit

func (r *FloatTopReducer) Emit() []FloatPoint

type IntegerBottomReducer

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

func NewIntegerBottomReducer

func NewIntegerBottomReducer(n int) *IntegerBottomReducer

func (*IntegerBottomReducer) AggregateInteger

func (r *IntegerBottomReducer) AggregateInteger(p *IntegerPoint)

func (*IntegerBottomReducer) Emit

func (r *IntegerBottomReducer) Emit() []IntegerPoint

type IntegerBulkPointAggregator

type IntegerBulkPointAggregator interface {
	AggregateIntegerBulk(points []IntegerPoint)
}

IntegerBulkPointAggregator aggregates multiple points at a time.

type IntegerCumulativeSumReducer

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

IntegerCumulativeSumReducer cumulates the values from each point.

func NewIntegerCumulativeSumReducer

func NewIntegerCumulativeSumReducer() *IntegerCumulativeSumReducer

NewIntegerCumulativeSumReducer creates a new IntegerCumulativeSumReducer.

func (*IntegerCumulativeSumReducer) AggregateInteger

func (r *IntegerCumulativeSumReducer) AggregateInteger(p *IntegerPoint)

func (*IntegerCumulativeSumReducer) Emit

type IntegerDerivativeReducer

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

IntegerDerivativeReducer calculates the derivative of the aggregated points.

func NewIntegerDerivativeReducer

func NewIntegerDerivativeReducer(interval Interval, isNonNegative, ascending bool) *IntegerDerivativeReducer

NewIntegerDerivativeReducer creates a new IntegerDerivativeReducer.

func (*IntegerDerivativeReducer) AggregateInteger

func (r *IntegerDerivativeReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer and updates the current window.

func (*IntegerDerivativeReducer) Emit

Emit emits the derivative of the reducer at the current point.

type IntegerDifferenceReducer

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

IntegerDifferenceReducer calculates the derivative of the aggregated points.

func NewIntegerDifferenceReducer

func NewIntegerDifferenceReducer(isNonNegative bool) *IntegerDifferenceReducer

NewIntegerDifferenceReducer creates a new IntegerDifferenceReducer.

func (*IntegerDifferenceReducer) AggregateInteger

func (r *IntegerDifferenceReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer and updates the current window.

func (*IntegerDifferenceReducer) Emit

Emit emits the difference of the reducer at the current point.

type IntegerDistinctReducer

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

IntegerDistinctReducer returns the distinct points in a series.

func NewIntegerDistinctReducer

func NewIntegerDistinctReducer() *IntegerDistinctReducer

NewIntegerDistinctReducer creates a new IntegerDistinctReducer.

func (*IntegerDistinctReducer) AggregateInteger

func (r *IntegerDistinctReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer.

func (*IntegerDistinctReducer) Emit

Emit emits the distinct points that have been aggregated into the reducer.

type IntegerElapsedReducer

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

IntegerElapsedReducer calculates the elapsed of the aggregated points.

func NewIntegerElapsedReducer

func NewIntegerElapsedReducer(interval Interval) *IntegerElapsedReducer

NewIntegerElapsedReducer creates a new IntegerElapsedReducer.

func (*IntegerElapsedReducer) AggregateInteger

func (r *IntegerElapsedReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer and updates the current window.

func (*IntegerElapsedReducer) Emit

func (r *IntegerElapsedReducer) Emit() []IntegerPoint

Emit emits the elapsed of the reducer at the current point.

type IntegerFuncBooleanReducer

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

IntegerFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewIntegerFuncBooleanReducer

func NewIntegerFuncBooleanReducer(fn IntegerReduceBooleanFunc, prev *BooleanPoint) *IntegerFuncBooleanReducer

NewIntegerFuncBooleanReducer creates a new IntegerFuncBooleanReducer.

func (*IntegerFuncBooleanReducer) AggregateInteger

func (r *IntegerFuncBooleanReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.

func (*IntegerFuncBooleanReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateInteger.

type IntegerFuncFloatReducer

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

IntegerFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewIntegerFuncFloatReducer

func NewIntegerFuncFloatReducer(fn IntegerReduceFloatFunc, prev *FloatPoint) *IntegerFuncFloatReducer

NewIntegerFuncFloatReducer creates a new IntegerFuncFloatReducer.

func (*IntegerFuncFloatReducer) AggregateInteger

func (r *IntegerFuncFloatReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.

func (*IntegerFuncFloatReducer) Emit

func (r *IntegerFuncFloatReducer) Emit() []FloatPoint

Emit emits the point that was generated when reducing the points fed in with AggregateInteger.

type IntegerFuncReducer

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

IntegerFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewIntegerFuncReducer

func NewIntegerFuncReducer(fn IntegerReduceFunc, prev *IntegerPoint) *IntegerFuncReducer

NewIntegerFuncReducer creates a new IntegerFuncIntegerReducer.

func (*IntegerFuncReducer) AggregateInteger

func (r *IntegerFuncReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.

func (*IntegerFuncReducer) Emit

func (r *IntegerFuncReducer) Emit() []IntegerPoint

Emit emits the point that was generated when reducing the points fed in with AggregateInteger.

type IntegerFuncStringReducer

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

IntegerFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewIntegerFuncStringReducer

func NewIntegerFuncStringReducer(fn IntegerReduceStringFunc, prev *StringPoint) *IntegerFuncStringReducer

NewIntegerFuncStringReducer creates a new IntegerFuncStringReducer.

func (*IntegerFuncStringReducer) AggregateInteger

func (r *IntegerFuncStringReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.

func (*IntegerFuncStringReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateInteger.

type IntegerFuncUnsignedReducer

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

IntegerFuncUnsignedReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewIntegerFuncUnsignedReducer

func NewIntegerFuncUnsignedReducer(fn IntegerReduceUnsignedFunc, prev *UnsignedPoint) *IntegerFuncUnsignedReducer

NewIntegerFuncUnsignedReducer creates a new IntegerFuncUnsignedReducer.

func (*IntegerFuncUnsignedReducer) AggregateInteger

func (r *IntegerFuncUnsignedReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger takes a IntegerPoint and invokes the reduce function with the current and new point to modify the current point.

func (*IntegerFuncUnsignedReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateInteger.

type IntegerIntegralReducer

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

IntegerIntegralReducer calculates the time-integral of the aggregated points.

func NewIntegerIntegralReducer

func NewIntegerIntegralReducer(interval Interval, opt IteratorOptions) *IntegerIntegralReducer

NewIntegerIntegralReducer creates a new IntegerIntegralReducer.

func (*IntegerIntegralReducer) AggregateInteger

func (r *IntegerIntegralReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer.

func (*IntegerIntegralReducer) Close

func (r *IntegerIntegralReducer) Close() error

Close flushes any in progress points to ensure any remaining points are emitted.

func (*IntegerIntegralReducer) Emit

func (r *IntegerIntegralReducer) Emit() []FloatPoint

Emit emits the time-integral of the aggregated points as a single FLOAT point InfluxQL convention dictates that outside a group-by-time clause we return a timestamp of zero. Within a group-by-time, we can set the time to ZeroTime and a higher level will change it to the start of the time group.

type IntegerIterator

type IntegerIterator interface {
	Iterator
	Next() (*IntegerPoint, error)
}

IntegerIterator represents a stream of integer points.

type IntegerMeanReducer

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

IntegerMeanReducer calculates the mean of the aggregated points.

func NewIntegerMeanReducer

func NewIntegerMeanReducer() *IntegerMeanReducer

NewIntegerMeanReducer creates a new IntegerMeanReducer.

func (*IntegerMeanReducer) AggregateInteger

func (r *IntegerMeanReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer.

func (*IntegerMeanReducer) Emit

func (r *IntegerMeanReducer) Emit() []FloatPoint

Emit emits the mean of the aggregated points as a single point.

type IntegerMovingAverageReducer

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

IntegerMovingAverageReducer calculates the moving average of the aggregated points.

func NewIntegerMovingAverageReducer

func NewIntegerMovingAverageReducer(n int) *IntegerMovingAverageReducer

NewIntegerMovingAverageReducer creates a new IntegerMovingAverageReducer.

func (*IntegerMovingAverageReducer) AggregateInteger

func (r *IntegerMovingAverageReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer and updates the current window.

func (*IntegerMovingAverageReducer) Emit

Emit emits the moving average of the current window. Emit should be called after every call to AggregateInteger and it will produce one point if there is enough data to fill a window, otherwise it will produce zero points.

type IntegerPoint

type IntegerPoint struct {
	Name string
	Tags Tags

	Time  int64
	Value int64
	Aux   []interface{}

	// Total number of points that were combined into this point from an aggregate.
	// If this is zero, the point is not the result of an aggregate function.
	Aggregated uint32
	Nil        bool
}

IntegerPoint represents a point with a int64 value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.

func IntegerModeReduceSlice

func IntegerModeReduceSlice(a []IntegerPoint) []IntegerPoint

IntegerModeReduceSlice returns the mode value within a window.

func IntegerSpreadReduceSlice

func IntegerSpreadReduceSlice(a []IntegerPoint) []IntegerPoint

IntegerSpreadReduceSlice returns the spread value within a window.

func (*IntegerPoint) Clone

func (v *IntegerPoint) Clone() *IntegerPoint

Clone returns a copy of v.

func (*IntegerPoint) CopyTo

func (v *IntegerPoint) CopyTo(other *IntegerPoint)

CopyTo makes a deep copy into the point.

type IntegerPointAggregator

type IntegerPointAggregator interface {
	AggregateInteger(p *IntegerPoint)
}

IntegerPointAggregator aggregates points to produce a single point.

type IntegerPointDecoder

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

IntegerPointDecoder decodes IntegerPoint points from a reader.

func NewIntegerPointDecoder

func NewIntegerPointDecoder(ctx context.Context, r io.Reader) *IntegerPointDecoder

NewIntegerPointDecoder returns a new instance of IntegerPointDecoder that reads from r.

func (*IntegerPointDecoder) DecodeIntegerPoint

func (dec *IntegerPointDecoder) DecodeIntegerPoint(p *IntegerPoint) error

DecodeIntegerPoint reads from the underlying reader and unmarshals into p.

func (*IntegerPointDecoder) Stats

func (dec *IntegerPointDecoder) Stats() IteratorStats

Stats returns iterator stats embedded within the stream.

type IntegerPointEmitter

type IntegerPointEmitter interface {
	Emit() []IntegerPoint
}

IntegerPointEmitter produces a single point from an aggregate.

type IntegerPointEncoder

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

IntegerPointEncoder encodes IntegerPoint points to a writer.

func NewIntegerPointEncoder

func NewIntegerPointEncoder(w io.Writer) *IntegerPointEncoder

NewIntegerPointEncoder returns a new instance of IntegerPointEncoder that writes to w.

func (*IntegerPointEncoder) EncodeIntegerPoint

func (enc *IntegerPointEncoder) EncodeIntegerPoint(p *IntegerPoint) error

EncodeIntegerPoint marshals and writes p to the underlying writer.

type IntegerReduceBooleanFunc

type IntegerReduceBooleanFunc func(prev *BooleanPoint, curr *IntegerPoint) (t int64, v bool, aux []interface{})

IntegerReduceBooleanFunc is the function called by a IntegerPoint reducer.

type IntegerReduceBooleanSliceFunc

type IntegerReduceBooleanSliceFunc func(a []IntegerPoint) []BooleanPoint

IntegerReduceBooleanSliceFunc is the function called by a IntegerPoint reducer.

type IntegerReduceFloatFunc

type IntegerReduceFloatFunc func(prev *FloatPoint, curr *IntegerPoint) (t int64, v float64, aux []interface{})

IntegerReduceFloatFunc is the function called by a IntegerPoint reducer.

type IntegerReduceFloatSliceFunc

type IntegerReduceFloatSliceFunc func(a []IntegerPoint) []FloatPoint

IntegerReduceFloatSliceFunc is the function called by a IntegerPoint reducer.

type IntegerReduceFunc

type IntegerReduceFunc func(prev *IntegerPoint, curr *IntegerPoint) (t int64, v int64, aux []interface{})

IntegerReduceFunc is the function called by a IntegerPoint reducer.

type IntegerReduceSliceFunc

type IntegerReduceSliceFunc func(a []IntegerPoint) []IntegerPoint

IntegerReduceSliceFunc is the function called by a IntegerPoint reducer.

func NewIntegerPercentileReduceSliceFunc

func NewIntegerPercentileReduceSliceFunc(percentile float64) IntegerReduceSliceFunc

NewIntegerPercentileReduceSliceFunc returns the percentile value within a window.

type IntegerReduceStringFunc

type IntegerReduceStringFunc func(prev *StringPoint, curr *IntegerPoint) (t int64, v string, aux []interface{})

IntegerReduceStringFunc is the function called by a IntegerPoint reducer.

type IntegerReduceStringSliceFunc

type IntegerReduceStringSliceFunc func(a []IntegerPoint) []StringPoint

IntegerReduceStringSliceFunc is the function called by a IntegerPoint reducer.

type IntegerReduceUnsignedFunc

type IntegerReduceUnsignedFunc func(prev *UnsignedPoint, curr *IntegerPoint) (t int64, v uint64, aux []interface{})

IntegerReduceUnsignedFunc is the function called by a IntegerPoint reducer.

type IntegerReduceUnsignedSliceFunc

type IntegerReduceUnsignedSliceFunc func(a []IntegerPoint) []UnsignedPoint

IntegerReduceUnsignedSliceFunc is the function called by a IntegerPoint reducer.

type IntegerSampleReducer

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

IntegerSampleReducer implements a reservoir sampling to calculate a random subset of points

func NewIntegerSampleReducer

func NewIntegerSampleReducer(size int) *IntegerSampleReducer

NewIntegerSampleReducer creates a new IntegerSampleReducer

func (*IntegerSampleReducer) AggregateInteger

func (r *IntegerSampleReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger aggregates a point into the reducer.

func (*IntegerSampleReducer) Emit

func (r *IntegerSampleReducer) Emit() []IntegerPoint

Emit emits the reservoir sample as many points.

type IntegerSliceFuncBooleanReducer

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

IntegerSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewIntegerSliceFuncBooleanReducer

func NewIntegerSliceFuncBooleanReducer(fn IntegerReduceBooleanSliceFunc) *IntegerSliceFuncBooleanReducer

NewIntegerSliceFuncBooleanReducer creates a new IntegerSliceFuncBooleanReducer.

func (*IntegerSliceFuncBooleanReducer) AggregateInteger

func (r *IntegerSliceFuncBooleanReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*IntegerSliceFuncBooleanReducer) AggregateIntegerBulk

func (r *IntegerSliceFuncBooleanReducer) AggregateIntegerBulk(points []IntegerPoint)

AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.

func (*IntegerSliceFuncBooleanReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type IntegerSliceFuncFloatReducer

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

IntegerSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewIntegerSliceFuncFloatReducer

func NewIntegerSliceFuncFloatReducer(fn IntegerReduceFloatSliceFunc) *IntegerSliceFuncFloatReducer

NewIntegerSliceFuncFloatReducer creates a new IntegerSliceFuncFloatReducer.

func (*IntegerSliceFuncFloatReducer) AggregateInteger

func (r *IntegerSliceFuncFloatReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*IntegerSliceFuncFloatReducer) AggregateIntegerBulk

func (r *IntegerSliceFuncFloatReducer) AggregateIntegerBulk(points []IntegerPoint)

AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.

func (*IntegerSliceFuncFloatReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type IntegerSliceFuncReducer

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

IntegerSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewIntegerSliceFuncReducer

func NewIntegerSliceFuncReducer(fn IntegerReduceSliceFunc) *IntegerSliceFuncReducer

NewIntegerSliceFuncReducer creates a new IntegerSliceFuncReducer.

func (*IntegerSliceFuncReducer) AggregateInteger

func (r *IntegerSliceFuncReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*IntegerSliceFuncReducer) AggregateIntegerBulk

func (r *IntegerSliceFuncReducer) AggregateIntegerBulk(points []IntegerPoint)

AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.

func (*IntegerSliceFuncReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type IntegerSliceFuncStringReducer

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

IntegerSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewIntegerSliceFuncStringReducer

func NewIntegerSliceFuncStringReducer(fn IntegerReduceStringSliceFunc) *IntegerSliceFuncStringReducer

NewIntegerSliceFuncStringReducer creates a new IntegerSliceFuncStringReducer.

func (*IntegerSliceFuncStringReducer) AggregateInteger

func (r *IntegerSliceFuncStringReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*IntegerSliceFuncStringReducer) AggregateIntegerBulk

func (r *IntegerSliceFuncStringReducer) AggregateIntegerBulk(points []IntegerPoint)

AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.

func (*IntegerSliceFuncStringReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type IntegerSliceFuncUnsignedReducer

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

IntegerSliceFuncUnsignedReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewIntegerSliceFuncUnsignedReducer

func NewIntegerSliceFuncUnsignedReducer(fn IntegerReduceUnsignedSliceFunc) *IntegerSliceFuncUnsignedReducer

NewIntegerSliceFuncUnsignedReducer creates a new IntegerSliceFuncUnsignedReducer.

func (*IntegerSliceFuncUnsignedReducer) AggregateInteger

func (r *IntegerSliceFuncUnsignedReducer) AggregateInteger(p *IntegerPoint)

AggregateInteger copies the IntegerPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*IntegerSliceFuncUnsignedReducer) AggregateIntegerBulk

func (r *IntegerSliceFuncUnsignedReducer) AggregateIntegerBulk(points []IntegerPoint)

AggregateIntegerBulk performs a bulk copy of IntegerPoints into the internal slice. This is a more efficient version of calling AggregateInteger on each point.

func (*IntegerSliceFuncUnsignedReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type IntegerTopReducer

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

func NewIntegerTopReducer

func NewIntegerTopReducer(n int) *IntegerTopReducer

func (*IntegerTopReducer) AggregateInteger

func (r *IntegerTopReducer) AggregateInteger(p *IntegerPoint)

func (*IntegerTopReducer) Emit

func (r *IntegerTopReducer) Emit() []IntegerPoint

type Interval

type Interval struct {
	Duration time.Duration
	Offset   time.Duration
}

Interval represents a repeating interval for a query.

func (Interval) IsZero

func (i Interval) IsZero() bool

IsZero returns true if the interval has no duration.

type Iterator

type Iterator interface {
	Stats() IteratorStats
	Close() error
}

Iterator represents a generic interface for all Iterators. Most iterator operations are done on the typed sub-interfaces.

func NewCallIterator

func NewCallIterator(input Iterator, opt IteratorOptions) (Iterator, error)

NewCallIterator returns a new iterator for a Call.

func NewCloseInterruptIterator

func NewCloseInterruptIterator(input Iterator, closing <-chan struct{}) Iterator

NewCloseInterruptIterator returns an iterator that will invoke the Close() method on an iterator when the passed-in channel has been closed.

func NewDedupeIterator

func NewDedupeIterator(input Iterator) Iterator

NewDedupeIterator returns an iterator that only outputs unique points. This iterator maintains a serialized copy of each row so it is inefficient to use on large datasets. It is intended for small datasets such as meta queries.

func NewDistinctIterator

func NewDistinctIterator(input Iterator, opt IteratorOptions) (Iterator, error)

NewDistinctIterator returns an iterator for operating on a distinct() call.

func NewFillIterator

func NewFillIterator(input Iterator, expr influxql.Expr, opt IteratorOptions) Iterator

NewFillIterator returns an iterator that fills in missing points in an aggregate.

func NewFilterIterator

func NewFilterIterator(input Iterator, cond influxql.Expr, opt IteratorOptions) Iterator

NewFilterIterator returns an iterator that filters the points based on the condition. This iterator is not nearly as efficient as filtering points within the query engine and is only used when filtering subqueries.

func NewInterruptIterator

func NewInterruptIterator(input Iterator, closing <-chan struct{}) Iterator

NewInterruptIterator returns an iterator that will stop producing output when the passed-in channel is closed.

func NewIntervalIterator

func NewIntervalIterator(input Iterator, opt IteratorOptions) Iterator

NewIntervalIterator returns an iterator that sets the time on each point to the interval.

func NewIteratorMapper

func NewIteratorMapper(itrs []Iterator, driver IteratorMap, fields []IteratorMap, opt IteratorOptions) Iterator

func NewLimitIterator

func NewLimitIterator(input Iterator, opt IteratorOptions) Iterator

NewLimitIterator returns an iterator that limits the number of points per grouping.

func NewMedianIterator

func NewMedianIterator(input Iterator, opt IteratorOptions) (Iterator, error)

NewMedianIterator returns an iterator for operating on a median() call.

func NewMergeIterator

func NewMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator

NewMergeIterator returns an iterator to merge itrs into one. Inputs must either be merge iterators or only contain a single name/tag in sorted order. The iterator will output all points by window, name/tag, then time. This iterator is useful when you need all of the points for an interval.

func NewModeIterator

func NewModeIterator(input Iterator, opt IteratorOptions) (Iterator, error)

newModeIterator returns an iterator for operating on a mode() call.

func NewParallelMergeIterator

func NewParallelMergeIterator(inputs []Iterator, opt IteratorOptions, parallelism int) Iterator

NewParallelMergeIterator returns an iterator that breaks input iterators into groups and processes them in parallel.

func NewReaderIterator

func NewReaderIterator(ctx context.Context, r io.Reader, typ influxql.DataType, stats IteratorStats) Iterator

NewReaderIterator returns an iterator that streams from a reader.

func NewSampleIterator

func NewSampleIterator(input Iterator, opt IteratorOptions, size int) (Iterator, error)

NewSampleIterator returns an iterator for operating on a sample() call (exported for use in test).

func NewSortedMergeIterator

func NewSortedMergeIterator(inputs []Iterator, opt IteratorOptions) Iterator

NewSortedMergeIterator returns an iterator to merge itrs into one. Inputs must either be sorted merge iterators or only contain a single name/tag in sorted order. The iterator will output all points by name/tag, then time. This iterator is useful when you need all points for a name/tag to be in order.

func Select

func Select(ctx context.Context, stmt *influxql.SelectStatement, shardMapper ShardMapper, opt SelectOptions) ([]Iterator, []string, error)

Select compiles, prepares, and then initiates execution of the query using the default compile options.

type IteratorCost

type IteratorCost struct {
	// The total number of shards that are touched by this query.
	NumShards int64

	// The total number of non-unique series that are accessed by this query.
	// This number matches the number of cursors created by the query since
	// one cursor is created for every series.
	NumSeries int64

	// CachedValues returns the number of cached values that may be read by this
	// query.
	CachedValues int64

	// The total number of non-unique files that may be accessed by this query.
	// This will count the number of files accessed by each series so files
	// will likely be double counted.
	NumFiles int64

	// The number of blocks that had the potential to be accessed.
	BlocksRead int64

	// The amount of data that can be potentially read.
	BlockSize int64
}

IteratorCost contains statistics retrieved for explaining what potential cost may be incurred by instantiating an iterator.

func (IteratorCost) Combine

func (c IteratorCost) Combine(other IteratorCost) IteratorCost

Combine combines the results of two IteratorCost structures into one.

type IteratorCreator

type IteratorCreator interface {
	// Creates a simple iterator for use in an InfluxQL query.
	CreateIterator(ctx context.Context, source *influxql.Measurement, opt IteratorOptions) (Iterator, error)

	// Determines the potential cost for creating an iterator.
	IteratorCost(source *influxql.Measurement, opt IteratorOptions) (IteratorCost, error)
}

IteratorCreator is an interface to create Iterators.

type IteratorEncoder

type IteratorEncoder struct {

	// Frequency with which stats are emitted.
	StatsInterval time.Duration
	// contains filtered or unexported fields
}

IteratorEncoder is an encoder for encoding an iterator's points to w.

func NewIteratorEncoder

func NewIteratorEncoder(w io.Writer) *IteratorEncoder

NewIteratorEncoder encodes an iterator's points to w.

func (*IteratorEncoder) EncodeIterator

func (enc *IteratorEncoder) EncodeIterator(itr Iterator) error

EncodeIterator encodes and writes all of itr's points to the underlying writer.

func (*IteratorEncoder) EncodeTrace

func (enc *IteratorEncoder) EncodeTrace(trace *tracing.Trace) error

type IteratorMap

type IteratorMap interface {
	Value(tags Tags, buf []interface{}) interface{}
}

type IteratorOptions

type IteratorOptions struct {
	// Expression to iterate for.
	// This can be VarRef or a Call.
	Expr influxql.Expr

	// Auxilary tags or values to also retrieve for the point.
	Aux []influxql.VarRef

	// Data sources from which to receive data. This is only used for encoding
	// measurements over RPC and is no longer used in the open source version.
	Sources []influxql.Source

	// Group by interval and tags.
	Interval   Interval
	Dimensions []string            // The final dimensions of the query (stays the same even in subqueries).
	GroupBy    map[string]struct{} // Dimensions to group points by in intermediate iterators.
	Location   *time.Location

	// Fill options.
	Fill      influxql.FillOption
	FillValue interface{}

	// Condition to filter by.
	Condition influxql.Expr

	// Time range for the iterator.
	StartTime int64
	EndTime   int64

	// Sorted in time ascending order if true.
	Ascending bool

	// Limits the number of points per series.
	Limit, Offset int

	// Limits the number of series.
	SLimit, SOffset int

	// Removes the measurement name. Useful for meta queries.
	StripName bool

	// Removes duplicate rows from raw queries.
	Dedupe bool

	// Determines if this is a query for raw data or an aggregate/selector.
	Ordered bool

	// Limits on the creation of iterators.
	MaxSeriesN int

	// If this channel is set and is closed, the iterator should try to exit
	// and close as soon as possible.
	InterruptCh <-chan struct{}

	// Authorizer can limit access to data
	Authorizer Authorizer
}

IteratorOptions is an object passed to CreateIterator to specify creation options.

func (IteratorOptions) DerivativeInterval

func (opt IteratorOptions) DerivativeInterval() Interval

DerivativeInterval returns the time interval for the derivative function.

func (IteratorOptions) ElapsedInterval

func (opt IteratorOptions) ElapsedInterval() Interval

ElapsedInterval returns the time interval for the elapsed function.

func (IteratorOptions) GetDimensions

func (opt IteratorOptions) GetDimensions() []string

GetDimensions retrieves the dimensions for this query.

func (IteratorOptions) IntegralInterval

func (opt IteratorOptions) IntegralInterval() Interval

IntegralInterval returns the time interval for the integral function.

func (*IteratorOptions) MarshalBinary

func (opt *IteratorOptions) MarshalBinary() ([]byte, error)

MarshalBinary encodes opt into a binary format.

func (IteratorOptions) MergeSorted

func (opt IteratorOptions) MergeSorted() bool

MergeSorted returns true if the options require a sorted merge.

func (IteratorOptions) SeekTime

func (opt IteratorOptions) SeekTime() int64

SeekTime returns the time the iterator should start from. For ascending iterators this is the start time, for descending iterators it's the end time.

func (*IteratorOptions) UnmarshalBinary

func (opt *IteratorOptions) UnmarshalBinary(buf []byte) error

UnmarshalBinary decodes from a binary format in to opt.

func (IteratorOptions) Window

func (opt IteratorOptions) Window(t int64) (start, end int64)

Window returns the time window [start,end) that t falls within.

func (*IteratorOptions) Zone

func (opt *IteratorOptions) Zone(ns int64) (string, int64)

Zone returns the zone information for the given time. The offset is in nanoseconds.

type IteratorStats

type IteratorStats struct {
	SeriesN int // series represented
	PointN  int // points returned
}

IteratorStats represents statistics about an iterator. Some statistics are available immediately upon iterator creation while some are derived as the iterator processes data.

func (*IteratorStats) Add

func (s *IteratorStats) Add(other IteratorStats)

Add aggregates fields from s and other together. Overwrites s.

type Iterators

type Iterators []Iterator

Iterators represents a list of iterators.

func (Iterators) Close

func (a Iterators) Close() error

Close closes all iterators.

func (Iterators) Merge

func (a Iterators) Merge(opt IteratorOptions) (Iterator, error)

Merge combines all iterators into a single iterator. A sorted merge iterator or a merge iterator can be used based on opt.

func (Iterators) Stats

func (a Iterators) Stats() IteratorStats

Stats returns the aggregation of all iterator stats.

type Message

type Message struct {
	Level string `json:"level"`
	Text  string `json:"text"`
}

Message represents a user-facing message to be included with the result.

func ReadOnlyWarning

func ReadOnlyWarning(stmt string) *Message

ReadOnlyWarning generates a warning message that tells the user the command they are using is being used for writing in a read only context.

This is a temporary method while to be used while transitioning to read only operations for issue #6290.

type NullMap

type NullMap struct{}

func (NullMap) Value

func (NullMap) Value(tags Tags, buf []interface{}) interface{}

type Point

type Point interface {
	// contains filtered or unexported methods
}

Point represents a value in a series that occurred at a given time.

type PointDecoder

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

PointDecoder decodes generic points from a reader.

func NewPointDecoder

func NewPointDecoder(r io.Reader) *PointDecoder

NewPointDecoder returns a new instance of PointDecoder that reads from r.

func (*PointDecoder) DecodePoint

func (dec *PointDecoder) DecodePoint(p *Point) error

DecodePoint reads from the underlying reader and unmarshals into p.

func (*PointDecoder) Stats

func (dec *PointDecoder) Stats() IteratorStats

Stats returns iterator stats embedded within the stream.

type Points

type Points []Point

Points represents a list of points.

func (Points) Clone

func (a Points) Clone() []Point

Clone returns a deep copy of a.

type PreparedStatement

type PreparedStatement interface {
	// Select creates the Iterators that will be used to read the query.
	Select(ctx context.Context) ([]Iterator, []string, error)

	// Explain outputs the explain plan for this statement.
	Explain() (string, error)

	// Close closes the resources associated with this prepared statement.
	// This must be called as the mapped shards may hold open resources such
	// as network connections.
	Close() error
}

Select is a prepared statement that is ready to be executed.

func Prepare

func Prepare(stmt *influxql.SelectStatement, shardMapper ShardMapper, opt SelectOptions) (PreparedStatement, error)

Prepare will compile the statement with the default compile options and then prepare the query.

type QueryExecutor

type QueryExecutor struct {
	// Used for executing a statement in the query.
	StatementExecutor StatementExecutor

	// Used for tracking running queries.
	TaskManager *TaskManager

	// Logger to use for all logging.
	// Defaults to discarding all log output.
	Logger *zap.Logger
	// contains filtered or unexported fields
}

QueryExecutor executes every statement in an Query.

func NewQueryExecutor

func NewQueryExecutor() *QueryExecutor

NewQueryExecutor returns a new instance of QueryExecutor.

func (*QueryExecutor) Close

func (e *QueryExecutor) Close() error

Close kills all running queries and prevents new queries from being attached.

func (*QueryExecutor) ExecuteQuery

func (e *QueryExecutor) ExecuteQuery(query *influxql.Query, opt ExecutionOptions, closing chan struct{}) <-chan *Result

ExecuteQuery executes each statement within a query.

func (*QueryExecutor) Statistics

func (e *QueryExecutor) Statistics(tags map[string]string) []models.Statistic

Statistics returns statistics for periodic monitoring.

func (*QueryExecutor) WithLogger

func (e *QueryExecutor) WithLogger(log *zap.Logger)

SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.

type QueryInfo

type QueryInfo struct {
	ID       uint64        `json:"id"`
	Query    string        `json:"query"`
	Database string        `json:"database"`
	Duration time.Duration `json:"duration"`
	Status   TaskStatus    `json:"status"`
}

QueryInfo represents the information for a query.

type QueryMonitorFunc

type QueryMonitorFunc func(<-chan struct{}) error

QueryMonitorFunc is a function that will be called to check if a query is currently healthy. If the query needs to be interrupted for some reason, the error should be returned by this function.

func PointLimitMonitor

func PointLimitMonitor(itrs Iterators, interval time.Duration, limit int) QueryMonitorFunc

PointLimitMonitor is a query monitor that exits when the number of points emitted exceeds a threshold.

type QueryStatistics

type QueryStatistics struct {
	ActiveQueries          int64
	ExecutedQueries        int64
	FinishedQueries        int64
	QueryExecutionDuration int64
	RecoveredPanics        int64
}

QueryStatistics keeps statistics related to the QueryExecutor.

type QueryTask

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

QueryTask is the internal data structure for managing queries. For the public use data structure that gets returned, see QueryTask.

func (*QueryTask) Error

func (q *QueryTask) Error() error

Error returns any asynchronous error that may have occured while executing the query.

func (*QueryTask) Monitor

func (q *QueryTask) Monitor(fn QueryMonitorFunc)

Monitor starts a new goroutine that will monitor a query. The function will be passed in a channel to signal when the query has been finished normally. If the function returns with an error and the query is still running, the query will be terminated.

type Result

type Result struct {
	// StatementID is just the statement's position in the query. It's used
	// to combine statement results if they're being buffered in memory.
	StatementID int
	Series      models.Rows
	Messages    []*Message
	Partial     bool
	Err         error
}

Result represents a resultset returned from a single statement. Rows represents a list of rows that can be sorted consistently by name/tag.

func (*Result) MarshalJSON

func (r *Result) MarshalJSON() ([]byte, error)

MarshalJSON encodes the result into JSON.

func (*Result) UnmarshalJSON

func (r *Result) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the data into the Result struct

type SelectOptions

type SelectOptions struct {
	// Authorizer is used to limit access to data
	Authorizer Authorizer

	// Node to exclusively read from.
	// If zero, all nodes are used.
	NodeID uint64

	// An optional channel that, if closed, signals that the select should be
	// interrupted.
	InterruptCh <-chan struct{}

	// Maximum number of concurrent series.
	MaxSeriesN int

	// Maximum number of buckets for a statement.
	MaxBucketsN int
}

SelectOptions are options that customize the select call.

type ShardGroup

type ShardGroup interface {
	IteratorCreator
	influxql.FieldMapper
	io.Closer
}

ShardGroup represents a shard or a collection of shards that can be accessed for creating iterators. When creating iterators, the resource used for reading the iterators should be separate from the resource used to map the shards. When the ShardGroup is closed, it should not close any resources associated with the created Iterator. Those resources belong to the Iterator and will be closed when the Iterator itself is closed. The query engine operates under this assumption and will close the shard group after creating the iterators, but before the iterators are actually read.

type ShardMapper

type ShardMapper interface {
	MapShards(sources influxql.Sources, t influxql.TimeRange, opt SelectOptions) (ShardGroup, error)
}

ShardMapper retrieves and maps shards into an IteratorCreator that can later be used for executing queries.

type Statement

type Statement interface {
	// Prepare prepares the statement by mapping shards and finishing the creation
	// of the query plan.
	Prepare(shardMapper ShardMapper, opt SelectOptions) (PreparedStatement, error)
}

Statement is a compiled query statement.

func Compile

func Compile(stmt *influxql.SelectStatement, opt CompileOptions) (Statement, error)

type StatementExecutor

type StatementExecutor interface {
	// ExecuteStatement executes a statement. Results should be sent to the
	// results channel in the ExecutionContext.
	ExecuteStatement(stmt influxql.Statement, ctx ExecutionContext) error
}

StatementExecutor executes a statement within the QueryExecutor.

type StatementNormalizer

type StatementNormalizer interface {
	// NormalizeStatement adds a default database and policy to the
	// measurements in the statement.
	NormalizeStatement(stmt influxql.Statement, database string) error
}

StatementNormalizer normalizes a statement before it is executed.

type StringBulkPointAggregator

type StringBulkPointAggregator interface {
	AggregateStringBulk(points []StringPoint)
}

StringBulkPointAggregator aggregates multiple points at a time.

type StringDistinctReducer

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

StringDistinctReducer returns the distinct points in a series.

func NewStringDistinctReducer

func NewStringDistinctReducer() *StringDistinctReducer

NewStringDistinctReducer creates a new StringDistinctReducer.

func (*StringDistinctReducer) AggregateString

func (r *StringDistinctReducer) AggregateString(p *StringPoint)

AggregateString aggregates a point into the reducer.

func (*StringDistinctReducer) Emit

func (r *StringDistinctReducer) Emit() []StringPoint

Emit emits the distinct points that have been aggregated into the reducer.

type StringElapsedReducer

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

StringElapsedReducer calculates the elapsed of the aggregated points.

func NewStringElapsedReducer

func NewStringElapsedReducer(interval Interval) *StringElapsedReducer

NewStringElapsedReducer creates a new StringElapsedReducer.

func (*StringElapsedReducer) AggregateString

func (r *StringElapsedReducer) AggregateString(p *StringPoint)

AggregateString aggregates a point into the reducer and updates the current window.

func (*StringElapsedReducer) Emit

func (r *StringElapsedReducer) Emit() []IntegerPoint

Emit emits the elapsed of the reducer at the current point.

type StringFuncBooleanReducer

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

StringFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewStringFuncBooleanReducer

func NewStringFuncBooleanReducer(fn StringReduceBooleanFunc, prev *BooleanPoint) *StringFuncBooleanReducer

NewStringFuncBooleanReducer creates a new StringFuncBooleanReducer.

func (*StringFuncBooleanReducer) AggregateString

func (r *StringFuncBooleanReducer) AggregateString(p *StringPoint)

AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.

func (*StringFuncBooleanReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateString.

type StringFuncFloatReducer

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

StringFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewStringFuncFloatReducer

func NewStringFuncFloatReducer(fn StringReduceFloatFunc, prev *FloatPoint) *StringFuncFloatReducer

NewStringFuncFloatReducer creates a new StringFuncFloatReducer.

func (*StringFuncFloatReducer) AggregateString

func (r *StringFuncFloatReducer) AggregateString(p *StringPoint)

AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.

func (*StringFuncFloatReducer) Emit

func (r *StringFuncFloatReducer) Emit() []FloatPoint

Emit emits the point that was generated when reducing the points fed in with AggregateString.

type StringFuncIntegerReducer

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

StringFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewStringFuncIntegerReducer

func NewStringFuncIntegerReducer(fn StringReduceIntegerFunc, prev *IntegerPoint) *StringFuncIntegerReducer

NewStringFuncIntegerReducer creates a new StringFuncIntegerReducer.

func (*StringFuncIntegerReducer) AggregateString

func (r *StringFuncIntegerReducer) AggregateString(p *StringPoint)

AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.

func (*StringFuncIntegerReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateString.

type StringFuncReducer

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

StringFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewStringFuncReducer

func NewStringFuncReducer(fn StringReduceFunc, prev *StringPoint) *StringFuncReducer

NewStringFuncReducer creates a new StringFuncStringReducer.

func (*StringFuncReducer) AggregateString

func (r *StringFuncReducer) AggregateString(p *StringPoint)

AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.

func (*StringFuncReducer) Emit

func (r *StringFuncReducer) Emit() []StringPoint

Emit emits the point that was generated when reducing the points fed in with AggregateString.

type StringFuncUnsignedReducer

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

StringFuncUnsignedReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewStringFuncUnsignedReducer

func NewStringFuncUnsignedReducer(fn StringReduceUnsignedFunc, prev *UnsignedPoint) *StringFuncUnsignedReducer

NewStringFuncUnsignedReducer creates a new StringFuncUnsignedReducer.

func (*StringFuncUnsignedReducer) AggregateString

func (r *StringFuncUnsignedReducer) AggregateString(p *StringPoint)

AggregateString takes a StringPoint and invokes the reduce function with the current and new point to modify the current point.

func (*StringFuncUnsignedReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateString.

type StringIterator

type StringIterator interface {
	Iterator
	Next() (*StringPoint, error)
}

StringIterator represents a stream of string points.

type StringPoint

type StringPoint struct {
	Name string
	Tags Tags

	Time  int64
	Value string
	Aux   []interface{}

	// Total number of points that were combined into this point from an aggregate.
	// If this is zero, the point is not the result of an aggregate function.
	Aggregated uint32
	Nil        bool
}

StringPoint represents a point with a string value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.

func StringModeReduceSlice

func StringModeReduceSlice(a []StringPoint) []StringPoint

StringModeReduceSlice returns the mode value within a window.

func (*StringPoint) Clone

func (v *StringPoint) Clone() *StringPoint

Clone returns a copy of v.

func (*StringPoint) CopyTo

func (v *StringPoint) CopyTo(other *StringPoint)

CopyTo makes a deep copy into the point.

type StringPointAggregator

type StringPointAggregator interface {
	AggregateString(p *StringPoint)
}

StringPointAggregator aggregates points to produce a single point.

type StringPointDecoder

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

StringPointDecoder decodes StringPoint points from a reader.

func NewStringPointDecoder

func NewStringPointDecoder(ctx context.Context, r io.Reader) *StringPointDecoder

NewStringPointDecoder returns a new instance of StringPointDecoder that reads from r.

func (*StringPointDecoder) DecodeStringPoint

func (dec *StringPointDecoder) DecodeStringPoint(p *StringPoint) error

DecodeStringPoint reads from the underlying reader and unmarshals into p.

func (*StringPointDecoder) Stats

func (dec *StringPointDecoder) Stats() IteratorStats

Stats returns iterator stats embedded within the stream.

type StringPointEmitter

type StringPointEmitter interface {
	Emit() []StringPoint
}

StringPointEmitter produces a single point from an aggregate.

type StringPointEncoder

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

StringPointEncoder encodes StringPoint points to a writer.

func NewStringPointEncoder

func NewStringPointEncoder(w io.Writer) *StringPointEncoder

NewStringPointEncoder returns a new instance of StringPointEncoder that writes to w.

func (*StringPointEncoder) EncodeStringPoint

func (enc *StringPointEncoder) EncodeStringPoint(p *StringPoint) error

EncodeStringPoint marshals and writes p to the underlying writer.

type StringReduceBooleanFunc

type StringReduceBooleanFunc func(prev *BooleanPoint, curr *StringPoint) (t int64, v bool, aux []interface{})

StringReduceBooleanFunc is the function called by a StringPoint reducer.

type StringReduceBooleanSliceFunc

type StringReduceBooleanSliceFunc func(a []StringPoint) []BooleanPoint

StringReduceBooleanSliceFunc is the function called by a StringPoint reducer.

type StringReduceFloatFunc

type StringReduceFloatFunc func(prev *FloatPoint, curr *StringPoint) (t int64, v float64, aux []interface{})

StringReduceFloatFunc is the function called by a StringPoint reducer.

type StringReduceFloatSliceFunc

type StringReduceFloatSliceFunc func(a []StringPoint) []FloatPoint

StringReduceFloatSliceFunc is the function called by a StringPoint reducer.

type StringReduceFunc

type StringReduceFunc func(prev *StringPoint, curr *StringPoint) (t int64, v string, aux []interface{})

StringReduceFunc is the function called by a StringPoint reducer.

type StringReduceIntegerFunc

type StringReduceIntegerFunc func(prev *IntegerPoint, curr *StringPoint) (t int64, v int64, aux []interface{})

StringReduceIntegerFunc is the function called by a StringPoint reducer.

type StringReduceIntegerSliceFunc

type StringReduceIntegerSliceFunc func(a []StringPoint) []IntegerPoint

StringReduceIntegerSliceFunc is the function called by a StringPoint reducer.

type StringReduceSliceFunc

type StringReduceSliceFunc func(a []StringPoint) []StringPoint

StringReduceSliceFunc is the function called by a StringPoint reducer.

type StringReduceUnsignedFunc

type StringReduceUnsignedFunc func(prev *UnsignedPoint, curr *StringPoint) (t int64, v uint64, aux []interface{})

StringReduceUnsignedFunc is the function called by a StringPoint reducer.

type StringReduceUnsignedSliceFunc

type StringReduceUnsignedSliceFunc func(a []StringPoint) []UnsignedPoint

StringReduceUnsignedSliceFunc is the function called by a StringPoint reducer.

type StringSampleReducer

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

StringSampleReducer implements a reservoir sampling to calculate a random subset of points

func NewStringSampleReducer

func NewStringSampleReducer(size int) *StringSampleReducer

NewStringSampleReducer creates a new StringSampleReducer

func (*StringSampleReducer) AggregateString

func (r *StringSampleReducer) AggregateString(p *StringPoint)

AggregateString aggregates a point into the reducer.

func (*StringSampleReducer) Emit

func (r *StringSampleReducer) Emit() []StringPoint

Emit emits the reservoir sample as many points.

type StringSliceFuncBooleanReducer

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

StringSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewStringSliceFuncBooleanReducer

func NewStringSliceFuncBooleanReducer(fn StringReduceBooleanSliceFunc) *StringSliceFuncBooleanReducer

NewStringSliceFuncBooleanReducer creates a new StringSliceFuncBooleanReducer.

func (*StringSliceFuncBooleanReducer) AggregateString

func (r *StringSliceFuncBooleanReducer) AggregateString(p *StringPoint)

AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*StringSliceFuncBooleanReducer) AggregateStringBulk

func (r *StringSliceFuncBooleanReducer) AggregateStringBulk(points []StringPoint)

AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.

func (*StringSliceFuncBooleanReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type StringSliceFuncFloatReducer

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

StringSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewStringSliceFuncFloatReducer

func NewStringSliceFuncFloatReducer(fn StringReduceFloatSliceFunc) *StringSliceFuncFloatReducer

NewStringSliceFuncFloatReducer creates a new StringSliceFuncFloatReducer.

func (*StringSliceFuncFloatReducer) AggregateString

func (r *StringSliceFuncFloatReducer) AggregateString(p *StringPoint)

AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*StringSliceFuncFloatReducer) AggregateStringBulk

func (r *StringSliceFuncFloatReducer) AggregateStringBulk(points []StringPoint)

AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.

func (*StringSliceFuncFloatReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type StringSliceFuncIntegerReducer

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

StringSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewStringSliceFuncIntegerReducer

func NewStringSliceFuncIntegerReducer(fn StringReduceIntegerSliceFunc) *StringSliceFuncIntegerReducer

NewStringSliceFuncIntegerReducer creates a new StringSliceFuncIntegerReducer.

func (*StringSliceFuncIntegerReducer) AggregateString

func (r *StringSliceFuncIntegerReducer) AggregateString(p *StringPoint)

AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*StringSliceFuncIntegerReducer) AggregateStringBulk

func (r *StringSliceFuncIntegerReducer) AggregateStringBulk(points []StringPoint)

AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.

func (*StringSliceFuncIntegerReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type StringSliceFuncReducer

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

StringSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewStringSliceFuncReducer

func NewStringSliceFuncReducer(fn StringReduceSliceFunc) *StringSliceFuncReducer

NewStringSliceFuncReducer creates a new StringSliceFuncReducer.

func (*StringSliceFuncReducer) AggregateString

func (r *StringSliceFuncReducer) AggregateString(p *StringPoint)

AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*StringSliceFuncReducer) AggregateStringBulk

func (r *StringSliceFuncReducer) AggregateStringBulk(points []StringPoint)

AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.

func (*StringSliceFuncReducer) Emit

func (r *StringSliceFuncReducer) Emit() []StringPoint

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type StringSliceFuncUnsignedReducer

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

StringSliceFuncUnsignedReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewStringSliceFuncUnsignedReducer

func NewStringSliceFuncUnsignedReducer(fn StringReduceUnsignedSliceFunc) *StringSliceFuncUnsignedReducer

NewStringSliceFuncUnsignedReducer creates a new StringSliceFuncUnsignedReducer.

func (*StringSliceFuncUnsignedReducer) AggregateString

func (r *StringSliceFuncUnsignedReducer) AggregateString(p *StringPoint)

AggregateString copies the StringPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*StringSliceFuncUnsignedReducer) AggregateStringBulk

func (r *StringSliceFuncUnsignedReducer) AggregateStringBulk(points []StringPoint)

AggregateStringBulk performs a bulk copy of StringPoints into the internal slice. This is a more efficient version of calling AggregateString on each point.

func (*StringSliceFuncUnsignedReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type TagMap

type TagMap string

func (TagMap) Value

func (s TagMap) Value(tags Tags, buf []interface{}) interface{}

type TagSet

type TagSet struct {
	Tags       map[string]string
	Filters    []influxql.Expr
	SeriesKeys []string
	Key        []byte
}

TagSet is a fundamental concept within the query system. It represents a composite series, composed of multiple individual series that share a set of tag attributes.

func LimitTagSets

func LimitTagSets(a []*TagSet, slimit, soffset int) []*TagSet

LimitTagSets returns a tag set list with SLIMIT and SOFFSET applied.

func (*TagSet) AddFilter

func (t *TagSet) AddFilter(key string, filter influxql.Expr)

AddFilter adds a series-level filter to the Tagset.

func (*TagSet) Len

func (t *TagSet) Len() int

func (*TagSet) Less

func (t *TagSet) Less(i, j int) bool

func (*TagSet) Reverse

func (t *TagSet) Reverse()

Reverse reverses the order of series keys and filters in the TagSet.

func (*TagSet) Swap

func (t *TagSet) Swap(i, j int)

type Tags

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

Tags represent a map of keys and values. It memoizes its key so it can be used efficiently during query execution.

func NewTags

func NewTags(m map[string]string) Tags

NewTags returns a new instance of Tags.

func (Tags) Equal

func (t Tags) Equal(other Tags) bool

Equal compares if the Tags are equal to each other.

func (*Tags) Equals

func (t *Tags) Equals(other *Tags) bool

Equals returns true if t equals other.

func (Tags) ID

func (t Tags) ID() string

ID returns the string identifier for the tags.

func (Tags) KeyValues

func (t Tags) KeyValues() map[string]string

KeyValues returns the underlying map for the tags.

func (*Tags) Keys

func (t *Tags) Keys() []string

Keys returns a sorted list of all keys on the tag.

func (*Tags) Subset

func (t *Tags) Subset(keys []string) Tags

Subset returns a new tags object with a subset of the keys.

func (*Tags) Value

func (t *Tags) Value(k string) string

Value returns the value for a given key.

func (*Tags) Values

func (t *Tags) Values() []string

Values returns a sorted list of all values on the tag.

type TaskManager

type TaskManager struct {
	// Query execution timeout.
	QueryTimeout time.Duration

	// Log queries if they are slower than this time.
	// If zero, slow queries will never be logged.
	LogQueriesAfter time.Duration

	// Maximum number of concurrent queries.
	MaxConcurrentQueries int

	// Logger to use for all logging.
	// Defaults to discarding all log output.
	Logger *zap.Logger
	// contains filtered or unexported fields
}

TaskManager takes care of all aspects related to managing running queries.

func NewTaskManager

func NewTaskManager() *TaskManager

NewTaskManager creates a new TaskManager.

func (*TaskManager) AttachQuery

func (t *TaskManager) AttachQuery(q *influxql.Query, database string, interrupt <-chan struct{}) (uint64, *QueryTask, error)

AttachQuery attaches a running query to be managed by the TaskManager. Returns the query id of the newly attached query or an error if it was unable to assign a query id or attach the query to the TaskManager. This function also returns a channel that will be closed when this query finishes running.

After a query finishes running, the system is free to reuse a query id.

func (*TaskManager) Close

func (t *TaskManager) Close() error

Close kills all running queries and prevents new queries from being attached.

func (*TaskManager) DetachQuery

func (t *TaskManager) DetachQuery(qid uint64) error

DetachQuery removes a query from the query table. If the query is not in the killed state, this will also close the related channel.

func (*TaskManager) ExecuteStatement

func (t *TaskManager) ExecuteStatement(stmt influxql.Statement, ctx ExecutionContext) error

ExecuteStatement executes a statement containing one of the task management queries.

func (*TaskManager) KillQuery

func (t *TaskManager) KillQuery(qid uint64) error

KillQuery enters a query into the killed state and closes the channel from the TaskManager. This method can be used to forcefully terminate a running query.

func (*TaskManager) Queries

func (t *TaskManager) Queries() []QueryInfo

Queries returns a list of all running queries with information about them.

type TaskStatus

type TaskStatus int
const (
	// RunningTask is set when the task is running.
	RunningTask TaskStatus = iota + 1

	// KilledTask is set when the task is killed, but resources are still
	// being used.
	KilledTask
)

func (TaskStatus) MarshalJSON added in v1.5.3

func (t TaskStatus) MarshalJSON() ([]byte, error)

func (TaskStatus) String

func (t TaskStatus) String() string

func (*TaskStatus) UnmarshalJSON added in v1.5.3

func (t *TaskStatus) UnmarshalJSON(data []byte) error

type UnsignedBottomReducer

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

func NewUnsignedBottomReducer

func NewUnsignedBottomReducer(n int) *UnsignedBottomReducer

func (*UnsignedBottomReducer) AggregateUnsigned

func (r *UnsignedBottomReducer) AggregateUnsigned(p *UnsignedPoint)

func (*UnsignedBottomReducer) Emit

type UnsignedBulkPointAggregator

type UnsignedBulkPointAggregator interface {
	AggregateUnsignedBulk(points []UnsignedPoint)
}

UnsignedBulkPointAggregator aggregates multiple points at a time.

type UnsignedCumulativeSumReducer

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

UnsignedCumulativeSumReducer cumulates the values from each point.

func NewUnsignedCumulativeSumReducer

func NewUnsignedCumulativeSumReducer() *UnsignedCumulativeSumReducer

NewUnsignedCumulativeSumReducer creates a new UnsignedCumulativeSumReducer.

func (*UnsignedCumulativeSumReducer) AggregateUnsigned

func (r *UnsignedCumulativeSumReducer) AggregateUnsigned(p *UnsignedPoint)

func (*UnsignedCumulativeSumReducer) Emit

type UnsignedDerivativeReducer

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

UnsignedDerivativeReducer calculates the derivative of the aggregated points.

func NewUnsignedDerivativeReducer

func NewUnsignedDerivativeReducer(interval Interval, isNonNegative, ascending bool) *UnsignedDerivativeReducer

NewUnsignedDerivativeReducer creates a new UnsignedDerivativeReducer.

func (*UnsignedDerivativeReducer) AggregateUnsigned

func (r *UnsignedDerivativeReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer and updates the current window.

func (*UnsignedDerivativeReducer) Emit

Emit emits the derivative of the reducer at the current point.

type UnsignedDifferenceReducer

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

UnsignedDifferenceReducer calculates the derivative of the aggregated points.

func NewUnsignedDifferenceReducer

func NewUnsignedDifferenceReducer(isNonNegative bool) *UnsignedDifferenceReducer

NewUnsignedDifferenceReducer creates a new UnsignedDifferenceReducer.

func (*UnsignedDifferenceReducer) AggregateUnsigned

func (r *UnsignedDifferenceReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer and updates the current window.

func (*UnsignedDifferenceReducer) Emit

Emit emits the difference of the reducer at the current point.

type UnsignedDistinctReducer

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

UnsignedDistinctReducer returns the distinct points in a series.

func NewUnsignedDistinctReducer

func NewUnsignedDistinctReducer() *UnsignedDistinctReducer

NewUnsignedDistinctReducer creates a new UnsignedDistinctReducer.

func (*UnsignedDistinctReducer) AggregateUnsigned

func (r *UnsignedDistinctReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer.

func (*UnsignedDistinctReducer) Emit

Emit emits the distinct points that have been aggregated into the reducer.

type UnsignedElapsedReducer

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

UnsignedElapsedReducer calculates the elapsed of the aggregated points.

func NewUnsignedElapsedReducer

func NewUnsignedElapsedReducer(interval Interval) *UnsignedElapsedReducer

NewUnsignedElapsedReducer creates a new UnsignedElapsedReducer.

func (*UnsignedElapsedReducer) AggregateUnsigned

func (r *UnsignedElapsedReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer and updates the current window.

func (*UnsignedElapsedReducer) Emit

Emit emits the elapsed of the reducer at the current point.

type UnsignedFuncBooleanReducer

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

UnsignedFuncBooleanReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewUnsignedFuncBooleanReducer

func NewUnsignedFuncBooleanReducer(fn UnsignedReduceBooleanFunc, prev *BooleanPoint) *UnsignedFuncBooleanReducer

NewUnsignedFuncBooleanReducer creates a new UnsignedFuncBooleanReducer.

func (*UnsignedFuncBooleanReducer) AggregateUnsigned

func (r *UnsignedFuncBooleanReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned takes a UnsignedPoint and invokes the reduce function with the current and new point to modify the current point.

func (*UnsignedFuncBooleanReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateUnsigned.

type UnsignedFuncFloatReducer

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

UnsignedFuncFloatReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewUnsignedFuncFloatReducer

func NewUnsignedFuncFloatReducer(fn UnsignedReduceFloatFunc, prev *FloatPoint) *UnsignedFuncFloatReducer

NewUnsignedFuncFloatReducer creates a new UnsignedFuncFloatReducer.

func (*UnsignedFuncFloatReducer) AggregateUnsigned

func (r *UnsignedFuncFloatReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned takes a UnsignedPoint and invokes the reduce function with the current and new point to modify the current point.

func (*UnsignedFuncFloatReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateUnsigned.

type UnsignedFuncIntegerReducer

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

UnsignedFuncIntegerReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewUnsignedFuncIntegerReducer

func NewUnsignedFuncIntegerReducer(fn UnsignedReduceIntegerFunc, prev *IntegerPoint) *UnsignedFuncIntegerReducer

NewUnsignedFuncIntegerReducer creates a new UnsignedFuncIntegerReducer.

func (*UnsignedFuncIntegerReducer) AggregateUnsigned

func (r *UnsignedFuncIntegerReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned takes a UnsignedPoint and invokes the reduce function with the current and new point to modify the current point.

func (*UnsignedFuncIntegerReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateUnsigned.

type UnsignedFuncReducer

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

UnsignedFuncReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewUnsignedFuncReducer

func NewUnsignedFuncReducer(fn UnsignedReduceFunc, prev *UnsignedPoint) *UnsignedFuncReducer

NewUnsignedFuncReducer creates a new UnsignedFuncUnsignedReducer.

func (*UnsignedFuncReducer) AggregateUnsigned

func (r *UnsignedFuncReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned takes a UnsignedPoint and invokes the reduce function with the current and new point to modify the current point.

func (*UnsignedFuncReducer) Emit

func (r *UnsignedFuncReducer) Emit() []UnsignedPoint

Emit emits the point that was generated when reducing the points fed in with AggregateUnsigned.

type UnsignedFuncStringReducer

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

UnsignedFuncStringReducer is a reducer that reduces the passed in points to a single point using a reduce function.

func NewUnsignedFuncStringReducer

func NewUnsignedFuncStringReducer(fn UnsignedReduceStringFunc, prev *StringPoint) *UnsignedFuncStringReducer

NewUnsignedFuncStringReducer creates a new UnsignedFuncStringReducer.

func (*UnsignedFuncStringReducer) AggregateUnsigned

func (r *UnsignedFuncStringReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned takes a UnsignedPoint and invokes the reduce function with the current and new point to modify the current point.

func (*UnsignedFuncStringReducer) Emit

Emit emits the point that was generated when reducing the points fed in with AggregateUnsigned.

type UnsignedIntegralReducer

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

IntegerIntegralReducer calculates the time-integral of the aggregated points.

func NewUnsignedIntegralReducer

func NewUnsignedIntegralReducer(interval Interval, opt IteratorOptions) *UnsignedIntegralReducer

NewUnsignedIntegralReducer creates a new UnsignedIntegralReducer.

func (*UnsignedIntegralReducer) AggregateUnsigned

func (r *UnsignedIntegralReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer.

func (*UnsignedIntegralReducer) Close

func (r *UnsignedIntegralReducer) Close() error

Close flushes any in progress points to ensure any remaining points are emitted.

func (*UnsignedIntegralReducer) Emit

func (r *UnsignedIntegralReducer) Emit() []FloatPoint

Emit emits the time-integral of the aggregated points as a single FLOAT point InfluxQL convention dictates that outside a group-by-time clause we return a timestamp of zero. Within a group-by-time, we can set the time to ZeroTime and a higher level will change it to the start of the time group.

type UnsignedIterator

type UnsignedIterator interface {
	Iterator
	Next() (*UnsignedPoint, error)
}

UnsignedIterator represents a stream of unsigned points.

type UnsignedMeanReducer

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

UnsignedMeanReducer calculates the mean of the aggregated points.

func NewUnsignedMeanReducer

func NewUnsignedMeanReducer() *UnsignedMeanReducer

NewUnsignedMeanReducer creates a new UnsignedMeanReducer.

func (*UnsignedMeanReducer) AggregateUnsigned

func (r *UnsignedMeanReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer.

func (*UnsignedMeanReducer) Emit

func (r *UnsignedMeanReducer) Emit() []FloatPoint

Emit emits the mean of the aggregated points as a single point.

type UnsignedMovingAverageReducer

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

UnsignedMovingAverageReducer calculates the moving average of the aggregated points.

func NewUnsignedMovingAverageReducer

func NewUnsignedMovingAverageReducer(n int) *UnsignedMovingAverageReducer

NewUnsignedMovingAverageReducer creates a new UnsignedMovingAverageReducer.

func (*UnsignedMovingAverageReducer) AggregateUnsigned

func (r *UnsignedMovingAverageReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer and updates the current window.

func (*UnsignedMovingAverageReducer) Emit

Emit emits the moving average of the current window. Emit should be called after every call to AggregateUnsigned and it will produce one point if there is enough data to fill a window, otherwise it will produce zero points.

type UnsignedPoint

type UnsignedPoint struct {
	Name string
	Tags Tags

	Time  int64
	Value uint64
	Aux   []interface{}

	// Total number of points that were combined into this point from an aggregate.
	// If this is zero, the point is not the result of an aggregate function.
	Aggregated uint32
	Nil        bool
}

UnsignedPoint represents a point with a uint64 value. DO NOT ADD ADDITIONAL FIELDS TO THIS STRUCT. See TestPoint_Fields in influxql/point_test.go for more details.

func UnsignedModeReduceSlice

func UnsignedModeReduceSlice(a []UnsignedPoint) []UnsignedPoint

UnsignedModeReduceSlice returns the mode value within a window.

func UnsignedSpreadReduceSlice

func UnsignedSpreadReduceSlice(a []UnsignedPoint) []UnsignedPoint

UnsignedSpreadReduceSlice returns the spread value within a window.

func (*UnsignedPoint) Clone

func (v *UnsignedPoint) Clone() *UnsignedPoint

Clone returns a copy of v.

func (*UnsignedPoint) CopyTo

func (v *UnsignedPoint) CopyTo(other *UnsignedPoint)

CopyTo makes a deep copy into the point.

type UnsignedPointAggregator

type UnsignedPointAggregator interface {
	AggregateUnsigned(p *UnsignedPoint)
}

UnsignedPointAggregator aggregates points to produce a single point.

type UnsignedPointDecoder

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

UnsignedPointDecoder decodes UnsignedPoint points from a reader.

func NewUnsignedPointDecoder

func NewUnsignedPointDecoder(ctx context.Context, r io.Reader) *UnsignedPointDecoder

NewUnsignedPointDecoder returns a new instance of UnsignedPointDecoder that reads from r.

func (*UnsignedPointDecoder) DecodeUnsignedPoint

func (dec *UnsignedPointDecoder) DecodeUnsignedPoint(p *UnsignedPoint) error

DecodeUnsignedPoint reads from the underlying reader and unmarshals into p.

func (*UnsignedPointDecoder) Stats

func (dec *UnsignedPointDecoder) Stats() IteratorStats

Stats returns iterator stats embedded within the stream.

type UnsignedPointEmitter

type UnsignedPointEmitter interface {
	Emit() []UnsignedPoint
}

UnsignedPointEmitter produces a single point from an aggregate.

type UnsignedPointEncoder

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

UnsignedPointEncoder encodes UnsignedPoint points to a writer.

func NewUnsignedPointEncoder

func NewUnsignedPointEncoder(w io.Writer) *UnsignedPointEncoder

NewUnsignedPointEncoder returns a new instance of UnsignedPointEncoder that writes to w.

func (*UnsignedPointEncoder) EncodeUnsignedPoint

func (enc *UnsignedPointEncoder) EncodeUnsignedPoint(p *UnsignedPoint) error

EncodeUnsignedPoint marshals and writes p to the underlying writer.

type UnsignedReduceBooleanFunc

type UnsignedReduceBooleanFunc func(prev *BooleanPoint, curr *UnsignedPoint) (t int64, v bool, aux []interface{})

UnsignedReduceBooleanFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceBooleanSliceFunc

type UnsignedReduceBooleanSliceFunc func(a []UnsignedPoint) []BooleanPoint

UnsignedReduceBooleanSliceFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceFloatFunc

type UnsignedReduceFloatFunc func(prev *FloatPoint, curr *UnsignedPoint) (t int64, v float64, aux []interface{})

UnsignedReduceFloatFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceFloatSliceFunc

type UnsignedReduceFloatSliceFunc func(a []UnsignedPoint) []FloatPoint

UnsignedReduceFloatSliceFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceFunc

type UnsignedReduceFunc func(prev *UnsignedPoint, curr *UnsignedPoint) (t int64, v uint64, aux []interface{})

UnsignedReduceFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceIntegerFunc

type UnsignedReduceIntegerFunc func(prev *IntegerPoint, curr *UnsignedPoint) (t int64, v int64, aux []interface{})

UnsignedReduceIntegerFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceIntegerSliceFunc

type UnsignedReduceIntegerSliceFunc func(a []UnsignedPoint) []IntegerPoint

UnsignedReduceIntegerSliceFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceSliceFunc

type UnsignedReduceSliceFunc func(a []UnsignedPoint) []UnsignedPoint

UnsignedReduceSliceFunc is the function called by a UnsignedPoint reducer.

func NewUnsignedPercentileReduceSliceFunc

func NewUnsignedPercentileReduceSliceFunc(percentile float64) UnsignedReduceSliceFunc

NewUnsignedPercentileReduceSliceFunc returns the percentile value within a window.

type UnsignedReduceStringFunc

type UnsignedReduceStringFunc func(prev *StringPoint, curr *UnsignedPoint) (t int64, v string, aux []interface{})

UnsignedReduceStringFunc is the function called by a UnsignedPoint reducer.

type UnsignedReduceStringSliceFunc

type UnsignedReduceStringSliceFunc func(a []UnsignedPoint) []StringPoint

UnsignedReduceStringSliceFunc is the function called by a UnsignedPoint reducer.

type UnsignedSampleReducer

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

UnsignedSampleReducer implements a reservoir sampling to calculate a random subset of points

func NewUnsignedSampleReducer

func NewUnsignedSampleReducer(size int) *UnsignedSampleReducer

NewUnsignedSampleReducer creates a new UnsignedSampleReducer

func (*UnsignedSampleReducer) AggregateUnsigned

func (r *UnsignedSampleReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned aggregates a point into the reducer.

func (*UnsignedSampleReducer) Emit

Emit emits the reservoir sample as many points.

type UnsignedSliceFuncBooleanReducer

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

UnsignedSliceFuncBooleanReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewUnsignedSliceFuncBooleanReducer

func NewUnsignedSliceFuncBooleanReducer(fn UnsignedReduceBooleanSliceFunc) *UnsignedSliceFuncBooleanReducer

NewUnsignedSliceFuncBooleanReducer creates a new UnsignedSliceFuncBooleanReducer.

func (*UnsignedSliceFuncBooleanReducer) AggregateUnsigned

func (r *UnsignedSliceFuncBooleanReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned copies the UnsignedPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*UnsignedSliceFuncBooleanReducer) AggregateUnsignedBulk

func (r *UnsignedSliceFuncBooleanReducer) AggregateUnsignedBulk(points []UnsignedPoint)

AggregateUnsignedBulk performs a bulk copy of UnsignedPoints into the internal slice. This is a more efficient version of calling AggregateUnsigned on each point.

func (*UnsignedSliceFuncBooleanReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type UnsignedSliceFuncFloatReducer

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

UnsignedSliceFuncFloatReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewUnsignedSliceFuncFloatReducer

func NewUnsignedSliceFuncFloatReducer(fn UnsignedReduceFloatSliceFunc) *UnsignedSliceFuncFloatReducer

NewUnsignedSliceFuncFloatReducer creates a new UnsignedSliceFuncFloatReducer.

func (*UnsignedSliceFuncFloatReducer) AggregateUnsigned

func (r *UnsignedSliceFuncFloatReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned copies the UnsignedPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*UnsignedSliceFuncFloatReducer) AggregateUnsignedBulk

func (r *UnsignedSliceFuncFloatReducer) AggregateUnsignedBulk(points []UnsignedPoint)

AggregateUnsignedBulk performs a bulk copy of UnsignedPoints into the internal slice. This is a more efficient version of calling AggregateUnsigned on each point.

func (*UnsignedSliceFuncFloatReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type UnsignedSliceFuncIntegerReducer

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

UnsignedSliceFuncIntegerReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewUnsignedSliceFuncIntegerReducer

func NewUnsignedSliceFuncIntegerReducer(fn UnsignedReduceIntegerSliceFunc) *UnsignedSliceFuncIntegerReducer

NewUnsignedSliceFuncIntegerReducer creates a new UnsignedSliceFuncIntegerReducer.

func (*UnsignedSliceFuncIntegerReducer) AggregateUnsigned

func (r *UnsignedSliceFuncIntegerReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned copies the UnsignedPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*UnsignedSliceFuncIntegerReducer) AggregateUnsignedBulk

func (r *UnsignedSliceFuncIntegerReducer) AggregateUnsignedBulk(points []UnsignedPoint)

AggregateUnsignedBulk performs a bulk copy of UnsignedPoints into the internal slice. This is a more efficient version of calling AggregateUnsigned on each point.

func (*UnsignedSliceFuncIntegerReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type UnsignedSliceFuncReducer

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

UnsignedSliceFuncReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewUnsignedSliceFuncReducer

func NewUnsignedSliceFuncReducer(fn UnsignedReduceSliceFunc) *UnsignedSliceFuncReducer

NewUnsignedSliceFuncReducer creates a new UnsignedSliceFuncReducer.

func (*UnsignedSliceFuncReducer) AggregateUnsigned

func (r *UnsignedSliceFuncReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned copies the UnsignedPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*UnsignedSliceFuncReducer) AggregateUnsignedBulk

func (r *UnsignedSliceFuncReducer) AggregateUnsignedBulk(points []UnsignedPoint)

AggregateUnsignedBulk performs a bulk copy of UnsignedPoints into the internal slice. This is a more efficient version of calling AggregateUnsigned on each point.

func (*UnsignedSliceFuncReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type UnsignedSliceFuncStringReducer

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

UnsignedSliceFuncStringReducer is a reducer that aggregates the passed in points and then invokes the function to reduce the points when they are emitted.

func NewUnsignedSliceFuncStringReducer

func NewUnsignedSliceFuncStringReducer(fn UnsignedReduceStringSliceFunc) *UnsignedSliceFuncStringReducer

NewUnsignedSliceFuncStringReducer creates a new UnsignedSliceFuncStringReducer.

func (*UnsignedSliceFuncStringReducer) AggregateUnsigned

func (r *UnsignedSliceFuncStringReducer) AggregateUnsigned(p *UnsignedPoint)

AggregateUnsigned copies the UnsignedPoint into the internal slice to be passed to the reduce function when Emit is called.

func (*UnsignedSliceFuncStringReducer) AggregateUnsignedBulk

func (r *UnsignedSliceFuncStringReducer) AggregateUnsignedBulk(points []UnsignedPoint)

AggregateUnsignedBulk performs a bulk copy of UnsignedPoints into the internal slice. This is a more efficient version of calling AggregateUnsigned on each point.

func (*UnsignedSliceFuncStringReducer) Emit

Emit invokes the reduce function on the aggregated points to generate the aggregated points. This method does not clear the points from the internal slice.

type UnsignedTopReducer

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

func NewUnsignedTopReducer

func NewUnsignedTopReducer(n int) *UnsignedTopReducer

func (*UnsignedTopReducer) AggregateUnsigned

func (r *UnsignedTopReducer) AggregateUnsigned(p *UnsignedPoint)

func (*UnsignedTopReducer) Emit

func (r *UnsignedTopReducer) Emit() []UnsignedPoint

Directories

Path Synopsis
Package query is a generated protocol buffer package.
Package query is a generated protocol buffer package.
Package neldermead is an implementation of the Nelder-Mead optimization method.
Package neldermead is an implementation of the Nelder-Mead optimization method.

Jump to

Keyboard shortcuts

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