reads

package
v2.7.11 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxPointsPerBlock is the maximum number of points in an encoded
	// block in a TSM file. It should match the value in the tsm1
	// package, but we don't want to import it.
	MaxPointsPerBlock = 1000
)

Variables

View Source
var (
	// nil sorts lowest
	NilSortLo = []byte{0x00}
	// nil sorts highest
	NilSortHi = []byte{0xff}
)

NilSort values determine the lexicographical order of nil values in the partition key

View Source
var BooleanEmptyArrayCursor cursors.BooleanArrayCursor = &booleanEmptyArrayCursor{}
View Source
var FloatEmptyArrayCursor cursors.FloatArrayCursor = &floatEmptyArrayCursor{}
View Source
var IntegerEmptyArrayCursor cursors.IntegerArrayCursor = &integerEmptyArrayCursor{}
View Source
var StringEmptyArrayCursor cursors.StringArrayCursor = &stringEmptyArrayCursor{}
View Source
var UnsignedEmptyArrayCursor cursors.UnsignedArrayCursor = &unsignedEmptyArrayCursor{}

Functions

func EvalExprBool

func EvalExprBool(expr influxql.Expr, m Valuer) bool

func ExprHasKey

func ExprHasKey(expr influxql.Expr, key string) bool

func HasFieldValueKey

func HasFieldValueKey(expr influxql.Expr) bool

func IsFalseBooleanLiteral added in v2.0.9

func IsFalseBooleanLiteral(expr influxql.Expr) bool

func IsLastDescendingAggregateOptimization added in v2.0.7

func IsLastDescendingAggregateOptimization(req *datatypes.ReadWindowAggregateRequest) bool

IsLastDescendingAggregateOptimization checks two things: If the request passed in is using the `last` aggregate type, and if it doesn't have a window. If both conditions are met, it returns false, otherwise, it returns true.

func IsLastDescendingGroupOptimization added in v2.0.7

func IsLastDescendingGroupOptimization(req *datatypes.ReadGroupRequest) bool

IsLastDescendingGroupOptimization checks if this request is using the `last` aggregate type. It returns true if an ascending cursor should be used (all other conditions) or a descending cursor (when `last` is used).

func IsTrueBooleanLiteral

func IsTrueBooleanLiteral(expr influxql.Expr) bool

func Modulo

func Modulo(dividend, modulus int64) int64

func NodeToExpr

func NodeToExpr(node *datatypes.Node, remap map[string]string) (influxql.Expr, error)

NodeToExpr transforms a predicate node to an influxql.Expr.

func PredicateToExprString

func PredicateToExprString(p *datatypes.Predicate) string

func ResultSetToLineProtocol

func ResultSetToLineProtocol(wr io.Writer, rs ResultSet) (err error)

ResultSetToLineProtocol transforms rs to line protocol and writes the output to wr.

func RewriteExprRemoveFieldValue

func RewriteExprRemoveFieldValue(expr influxql.Expr) influxql.Expr

func WalkChildren

func WalkChildren(v NodeVisitor, node *datatypes.Node)

func WalkNode

func WalkNode(v NodeVisitor, node *datatypes.Node)

func WindowStart

func WindowStart(t, every, offset int64) int64

WindowStart calculates the start time of a window given a timestamp, the window period (every), and the offset starting from the epoch.

Note that the normalized offset value can fall on either side of the normalized timestamp. If it lies to the left we know it represents the start time. Otherwise it represents the stop time, in which case we decrement by the window period to get the start time.

func WindowStop

func WindowStop(t, every, offset int64) int64

WindowStop calculates the stop time of a window given a timestamp, the window period (every), and the offset starting from the epoch.

Note that the normalized offset value can fall on either side of the normalized timestamp. If it lies to the right we know it represents the stop time. Otherwise it represents the start time, in which case we increment by the window period to get the stop time.

Types

type GroupCursor

type GroupCursor interface {
	// Next advances to the next cursor. Next will return false when there are no
	// more cursors in the current group.
	Next() bool

	// Cursor returns the most recent cursor after a call to Next.
	Cursor() cursors.Cursor

	// Tags returns the tags for the most recent cursor after a call to Next.
	Tags() models.Tags

	// Keys returns the union of all tag key names for all series produced by
	// this GroupCursor.
	Keys() [][]byte

	// PartitionKeyVals returns the values of all tags identified by the
	// keys specified in ReadRequest#GroupKeys. The tag values values will
	// appear in the same order as the GroupKeys.
	//
	// When the datatypes.GroupNone strategy is specified, PartitionKeyVals will
	// be nil.
	PartitionKeyVals() [][]byte

	// Close releases any resources allocated by the GroupCursor.
	Close()

	// Err returns the first error encountered by the GroupCursor.
	Err() error

	Stats() cursors.CursorStats

	Aggregate() *datatypes.Aggregate
}

type GroupOption

type GroupOption func(g *groupResultSet)

func GroupOptionNilSortLo

func GroupOptionNilSortLo() GroupOption

GroupOptionNilSortLo configures nil values to be sorted lower than any other value

type GroupResultSet

type GroupResultSet interface {
	// Next advances the GroupResultSet and returns the next GroupCursor. It
	// returns nil if there are no more groups.
	Next() GroupCursor

	// Close releases any resources allocated by the GroupResultSet.
	Close()

	// Err returns the first error encountered by the GroupResultSet.
	Err() error
}

func NewGroupResultSet

func NewGroupResultSet(ctx context.Context, req *datatypes.ReadGroupRequest, newSeriesCursorFn func() (SeriesCursor, error), opts ...GroupOption) GroupResultSet

type KeyMerger

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

tagsKeyMerger is responsible for determining a merged set of tag keys

func (*KeyMerger) Clear

func (km *KeyMerger) Clear()

func (*KeyMerger) Get

func (km *KeyMerger) Get() [][]byte

func (*KeyMerger) MergeKeys

func (km *KeyMerger) MergeKeys(in [][]byte)

func (*KeyMerger) MergeTagKeys

func (km *KeyMerger) MergeTagKeys(tags models.Tags)

func (*KeyMerger) String

func (km *KeyMerger) String() string

type NodeVisitor

type NodeVisitor interface {
	Visit(*datatypes.Node) NodeVisitor
}

NodeVisitor can be called by Walk to traverse the Node hierarchy. The Visit() function is called once per node.

type ResultSet

type ResultSet interface {
	// Next advances the ResultSet to the next cursor. It returns false
	// when there are no more cursors.
	Next() bool

	// Cursor returns the most recent cursor after a call to Next.
	Cursor() cursors.Cursor

	// Tags returns the tags for the most recent cursor after a call to Next.
	Tags() models.Tags

	// Close releases any resources allocated by the ResultSet.
	Close()

	// Err returns the first error encountered by the ResultSet.
	Err() error

	Stats() cursors.CursorStats
}

func NewFilteredResultSet

func NewFilteredResultSet(ctx context.Context, start, end int64, seriesCursor SeriesCursor) ResultSet

TODO(jsternberg): The range is [start, end) for this function which is consistent with the documented interface for datatypes.ReadFilterRequest. This function should be refactored to take in a datatypes.ReadFilterRequest similar to the other ResultSet functions.

func NewWindowAggregateResultSet

func NewWindowAggregateResultSet(ctx context.Context, req *datatypes.ReadWindowAggregateRequest, cursor SeriesCursor) (ResultSet, error)

type SeriesCursor

type SeriesCursor interface {
	Close()
	Next() *SeriesRow
	Err() error
}

func NewLimitSeriesCursor

func NewLimitSeriesCursor(ctx context.Context, cur SeriesCursor, n, o int64) SeriesCursor

type SeriesRow

type SeriesRow struct {
	SortKey    []byte
	Name       []byte      // measurement name
	SeriesTags models.Tags // unmodified series tags
	Tags       models.Tags
	Field      string
	Query      cursors.CursorIterators
	ValueCond  influxql.Expr
}

type Store

type Store interface {
	ReadFilter(ctx context.Context, req *datatypes.ReadFilterRequest) (ResultSet, error)
	ReadGroup(ctx context.Context, req *datatypes.ReadGroupRequest) (GroupResultSet, error)
	// WindowAggregate will invoke a ReadWindowAggregateRequest against the Store.
	WindowAggregate(ctx context.Context, req *datatypes.ReadWindowAggregateRequest) (ResultSet, error)

	TagKeys(ctx context.Context, req *datatypes.TagKeysRequest) (cursors.StringIterator, error)
	TagValues(ctx context.Context, req *datatypes.TagValuesRequest) (cursors.StringIterator, error)

	ReadSeriesCardinality(ctx context.Context, req *datatypes.ReadSeriesCardinalityRequest) (cursors.Int64Iterator, error)
	SupportReadSeriesCardinality(ctx context.Context) bool

	GetSource(orgID, bucketID uint64) proto.Message
}

type Valuer

type Valuer interface {
	// Value returns the value and existence flag for a given key.
	Value(key string) (interface{}, bool)
}

Valuer is the interface that wraps the Value() method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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