Documentation ¶
Index ¶
- Constants
- Variables
- func BucketsAccessed(q *flux.Spec) (readBuckets, writeBuckets []platform.BucketFilter, err error)
- func ContextWithRequest(ctx context.Context, req *Request) context.Context
- type AsyncQueryService
- type Authorizer
- type BooleanIterator
- type BooleanPoint
- type BucketAwareOperationSpec
- type BucketLookup
- type FloatIterator
- type FloatPoint
- type IntegerIterator
- type IntegerPoint
- type Interval
- type Iterator
- type IteratorCost
- type IteratorOptions
- type IteratorStats
- type Log
- type Logger
- type LoggingServiceBridge
- type MathValuer
- type OrganizationLookup
- type PreAuthorizer
- type ProxyQueryService
- type ProxyQueryServiceBridge
- type ProxyRequest
- type QueryService
- type QueryServiceBridge
- type REPLQuerier
- type Request
- type StringIterator
- type StringPoint
- type TagSet
- type Tags
- type UnsignedIterator
- type UnsignedPoint
Constants ¶
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 ¶
var ( // ErrQueryInterrupted is an error returned when the query is interrupted. ErrQueryInterrupted = errors.New("query interrupted") )
var OpenAuthorizer = openAuthorizer{}
OpenAuthorizer can be shared by all goroutines.
Functions ¶
func BucketsAccessed ¶
func BucketsAccessed(q *flux.Spec) (readBuckets, writeBuckets []platform.BucketFilter, err error)
BucketsAccessed returns the set of buckets read and written by a query spec
Types ¶
type AsyncQueryService ¶
type AsyncQueryService interface { // Query submits a query for execution returning immediately. // Done must be called on any returned Query objects. Query(ctx context.Context, req *Request) (flux.Query, error) }
AsyncQueryService represents a service for performing queries where the results are delivered asynchronously.
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 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.
type BucketAwareOperationSpec ¶
type BucketAwareOperationSpec interface {
BucketsAccessed() (readBuckets, writeBuckets []platform.BucketFilter)
}
BucketAwareOperationSpec specifies an operation that reads or writes buckets
type BucketLookup ¶
type BucketLookup struct {
BucketService platform.BucketService
}
BucketLookup converts Flux bucket lookups into platform.BucketService calls.
func FromBucketService ¶
func FromBucketService(srv platform.BucketService) *BucketLookup
FromBucketService wraps an platform.BucketService in the BucketLookup interface.
func (*BucketLookup) FindAllBuckets ¶
type FloatIterator ¶
type FloatIterator interface { Iterator Next() (*FloatPoint, error) }
FloatIterator represents a stream of float 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.
type IntegerIterator ¶
type IntegerIterator interface { Iterator Next() (*IntegerPoint, error) }
IntegerIterator represents a stream of integer 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.
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.
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 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) 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) StopTime ¶
func (opt IteratorOptions) StopTime() int64
StopTime returns the time the iterator should end at. For ascending iterators this is the end time, for descending iterators it's the start time.
type IteratorStats ¶
IteratorStats represents statistics about an iterator. Some statistics are available immediately upon iterator creation while some are derived as the iterator processes data.
type Log ¶
type Log struct { // Time is the time the query was completed Time time.Time // OrganizationID is the ID of the organization that requested the query OrganizationID platform.ID // Error is any error encountered by the query Error error // ProxyRequest is the query request ProxyRequest *ProxyRequest // ResponseSize is the size in bytes of the query response ResponseSize int64 // Statistics is a set of statistics about the query execution Statistics flux.Statistics }
Log captures a query and any relevant metadata for the query execution.
type LoggingServiceBridge ¶
type LoggingServiceBridge struct { QueryService QueryService QueryLogger Logger }
LoggingServiceBridge implements ProxyQueryService and logs the queries while consuming a QueryService interface.
func (*LoggingServiceBridge) Query ¶
func (s *LoggingServiceBridge) Query(ctx context.Context, w io.Writer, req *ProxyRequest) (n int64, err error)
Query executes and logs the query.
type MathValuer ¶
type MathValuer struct{}
func (MathValuer) Call ¶
func (v MathValuer) Call(name string, args []interface{}) (interface{}, bool)
func (MathValuer) Value ¶
func (MathValuer) Value(key string) (interface{}, bool)
type OrganizationLookup ¶
type OrganizationLookup struct {
OrganizationService platform.OrganizationService
}
OrganizationLookup converts organization name lookups into platform.OrganizationService calls.
func FromOrganizationService ¶
func FromOrganizationService(srv platform.OrganizationService) *OrganizationLookup
FromOrganizationService wraps a platform.OrganizationService in the OrganizationLookup interface.
type PreAuthorizer ¶
type PreAuthorizer interface {
PreAuthorize(ctx context.Context, spec *flux.Spec, auth platform.Authorizer) error
}
PreAuthorizer provides a method for ensuring that the buckets accessed by a query spec are allowed access by the given Authorization. This is a pre-check provided as a way for callers to fail early for operations that are not allowed. However, it's still possible for authorization to be denied at runtime even if this check passes.
func NewPreAuthorizer ¶
func NewPreAuthorizer(bucketService platform.BucketService) PreAuthorizer
NewPreAuthorizer creates a new PreAuthorizer
type ProxyQueryService ¶
type ProxyQueryService interface { // Query performs the requested query and encodes the results into w. // The number of bytes written to w is returned __independent__ of any error. Query(ctx context.Context, w io.Writer, req *ProxyRequest) (int64, error) }
ProxyQueryService performs queries and encodes the result into a writer. The results are opaque to a ProxyQueryService.
type ProxyQueryServiceBridge ¶
type ProxyQueryServiceBridge struct {
QueryService QueryService
}
ProxyQueryServiceBridge implements ProxyQueryService while consuming a QueryService interface.
func (ProxyQueryServiceBridge) Query ¶
func (b ProxyQueryServiceBridge) Query(ctx context.Context, w io.Writer, req *ProxyRequest) (int64, error)
type ProxyRequest ¶
type ProxyRequest struct { // Request is the basic query request Request Request `json:"request"` // Dialect is the result encoder Dialect flux.Dialect `json:"dialect"` // contains filtered or unexported fields }
ProxyRequest specifies a query request and the dialect for the results.
func (ProxyRequest) MarshalJSON ¶
func (r ProxyRequest) MarshalJSON() ([]byte, error)
func (*ProxyRequest) UnmarshalJSON ¶
func (r *ProxyRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON populates the request from the JSON data. WithCompilerMappings and WithDialectMappings must have been called or an error will occur.
func (*ProxyRequest) WithCompilerMappings ¶
func (r *ProxyRequest) WithCompilerMappings(mappings flux.CompilerMappings)
WithCompilerMappings sets the compiler type mappings on the request.
func (*ProxyRequest) WithDialectMappings ¶
func (r *ProxyRequest) WithDialectMappings(mappings flux.DialectMappings)
WithDialectMappings sets the dialect type mappings on the request.
type QueryService ¶
type QueryService interface { // Query submits a query for execution returning a results iterator. // Cancel must be called on any returned results to free resources. Query(ctx context.Context, req *Request) (flux.ResultIterator, error) }
QueryService represents a type capable of performing queries.
type QueryServiceBridge ¶
type QueryServiceBridge struct {
AsyncQueryService AsyncQueryService
}
QueryServiceBridge implements the QueryService interface while consuming the AsyncQueryService interface.
func (QueryServiceBridge) Query ¶
func (b QueryServiceBridge) Query(ctx context.Context, req *Request) (flux.ResultIterator, error)
type REPLQuerier ¶
type REPLQuerier struct { // Authorization is the authorization to provide for all requests Authorization *platform.Authorization // OrganizationID is the ID to provide for all requests OrganizationID platform.ID QueryService QueryService }
REPLQuerier implements the repl.Querier interface while consuming a QueryService
func (*REPLQuerier) Query ¶
func (q *REPLQuerier) Query(ctx context.Context, compiler flux.Compiler) (flux.ResultIterator, error)
type Request ¶
type Request struct { // Scope Authorization *platform.Authorization `json:"authorization,omitempty"` OrganizationID platform.ID `json:"organization_id"` // Compiler converts the query to a specification to run against the data. Compiler flux.Compiler `json:"compiler"` // contains filtered or unexported fields }
Request respresents the query to run.
func RequestFromContext ¶
RequestFromContext retrieves a *Request from a context. If not request exists on the context nil is returned.
func (Request) MarshalJSON ¶
func (*Request) UnmarshalJSON ¶
UnmarshalJSON populates the request from the JSON data. WithCompilerMappings must have been called or an error will occur.
func (*Request) WithCompilerMappings ¶
func (r *Request) WithCompilerMappings(mappings flux.CompilerMappings)
WithCompilerMappings sets the query type mappings on the request.
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.
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.
type Tags ¶
type Tags struct{}
Tags represent a map of keys and values. It memoizes its key so it can be used efficiently during query execution.
type UnsignedIterator ¶
type UnsignedIterator interface { Iterator Next() (*UnsignedPoint, error) }
UnsignedIterator represents a stream of unsigned 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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package builtin ensures all packages related to Flux built-ins are imported and initialized.
|
Package builtin ensures all packages related to Flux built-ins are imported and initialized. |
Package control provides a query controller.
|
Package control provides a query controller. |
inputs/storage
Package storage implements reading from a storage engine into a table as a data source.
|
Package storage implements reading from a storage engine into a table as a data source. |
Package influxql implements the transpiler for executing influxql queries in the 2.0 query engine.
|
Package influxql implements the transpiler for executing influxql queries in the 2.0 query engine. |
spectests
Package spectests the influxql transpiler specification tests.
|
Package spectests the influxql transpiler specification tests. |
Package options implements flux options.
|
Package options implements flux options. |
Package promql implements a promql parser to build flux query specifications from promql.
|
Package promql implements a promql parser to build flux query specifications from promql. |