cursors

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultMaxPointsPerBlock = 1000

Variables

View Source
var EmptyMeasurementFieldsIterator = &measurementFieldsIterator{}

EmptyMeasurementFieldsIterator is an implementation of MeasurementFieldsIterator that returns no values.

Functions

func FieldTypeToDataType

func FieldTypeToDataType(ft FieldType) influxql.DataType

FieldTypeToDataType returns the equivalent influxql DataType for the field type ft. If ft is an invalid FieldType, the results are undefined.

func Int64SliceIteratorToSlice added in v2.0.9

func Int64SliceIteratorToSlice(i Int64Iterator) []int64

Int64SliceIteratorToSlice reads the remainder of i into a slice and returns the result.

func StringIteratorToSlice

func StringIteratorToSlice(i StringIterator) []string

StringIteratorToSlice reads the remainder of i into a slice and returns the result.

Types

type BooleanArray

type BooleanArray struct {
	Timestamps []int64
	Values     []bool
}

func NewBooleanArrayLen

func NewBooleanArrayLen(sz int) *BooleanArray

func (*BooleanArray) Exclude

func (a *BooleanArray) Exclude(min, max int64)

Exclude removes the subset of values in [min, max]. The values must be deduplicated and sorted before calling Exclude or the results are undefined.

func (*BooleanArray) FindRange

func (a *BooleanArray) FindRange(min, max int64) (int, int)

FindRange returns the positions where min and max would be inserted into the array. If a[0].UnixNano() > max or a[len-1].UnixNano() < min then FindRange returns (-1, -1) indicating the array is outside the [min, max]. The values must be deduplicated and sorted before calling FindRange or the results are undefined.

func (*BooleanArray) Include

func (a *BooleanArray) Include(min, max int64)

Include returns the subset values between min and max inclusive. The values must be deduplicated and sorted before calling Include or the results are undefined.

func (*BooleanArray) Len

func (a *BooleanArray) Len() int

func (*BooleanArray) MaxTime

func (a *BooleanArray) MaxTime() int64

func (*BooleanArray) Merge

func (a *BooleanArray) Merge(b *BooleanArray)

Merge overlays b to top of a. If two values conflict with the same timestamp, b is used. Both a and b must be sorted in ascending order.

func (*BooleanArray) MinTime

func (a *BooleanArray) MinTime() int64

func (*BooleanArray) Size

func (a *BooleanArray) Size() int

type BooleanArrayCursor

type BooleanArrayCursor interface {
	Cursor
	Next() *BooleanArray
}

type Cursor

type Cursor interface {
	Close()
	Err() error
	Stats() CursorStats
}

type CursorIterator

type CursorIterator interface {
	Next(ctx context.Context, r *CursorRequest) (Cursor, error)
	Stats() CursorStats
}

type CursorIterators

type CursorIterators []CursorIterator

func (CursorIterators) Stats

func (a CursorIterators) Stats() CursorStats

Stats returns the aggregate stats of all cursor iterators.

type CursorRequest

type CursorRequest struct {
	// Name is the measurement name a cursor is requested for.
	Name []byte

	// Tags is the set of series tags a cursor is requested for.
	Tags models.Tags

	// Field is the selected field for the cursor that is requested.
	Field string

	// Ascending is whether the cursor should move in an ascending
	// or descending time order.
	Ascending bool

	// StartTime is the start time of the cursor. It is the lower
	// absolute time regardless of the Ascending flag. This value
	// is an inclusive bound.
	StartTime int64

	// EndTime is the end time of the cursor. It is the higher
	// absolute time regardless of the Ascending flag. This value
	// is an inclusive bound.
	EndTime int64
}

CursorRequest is a request to the storage engine for a cursor to be created with the given name, tags, and field for a given direction and time range.

type CursorStats

type CursorStats struct {
	ScannedValues int // number of values scanned
	ScannedBytes  int // number of uncompressed bytes scanned
}

CursorStats represents stats collected by a cursor.

func (*CursorStats) Add

func (s *CursorStats) Add(other CursorStats)

Add adds other to s and updates s.

type FieldType

type FieldType int

FieldType represents the primitive field data types available in tsm.

const (
	Float     FieldType = iota // means the data type is a float
	Integer                    // means the data type is an integer
	Unsigned                   // means the data type is an unsigned integer
	String                     // means the data type is a string of text
	Boolean                    // means the data type is a boolean
	Undefined                  // means the data type in unknown or undefined
)

func ModelsFieldTypeToFieldType

func ModelsFieldTypeToFieldType(ft models.FieldType) FieldType

ModelsFieldTypeToFieldType returns the equivalent FieldType for ft. If ft is an invalid FieldType, the results are undefined.

func (FieldType) IsLower

func (ft FieldType) IsLower(other FieldType) bool

IsLower returns true if the other FieldType has greater precedence than the current value. Undefined has the lowest precedence.

func (FieldType) String

func (i FieldType) String() string

type FloatArray

type FloatArray struct {
	Timestamps []int64
	Values     []float64
}

func NewFloatArrayLen

func NewFloatArrayLen(sz int) *FloatArray

func (*FloatArray) Exclude

func (a *FloatArray) Exclude(min, max int64)

Exclude removes the subset of values in [min, max]. The values must be deduplicated and sorted before calling Exclude or the results are undefined.

func (*FloatArray) FindRange

func (a *FloatArray) FindRange(min, max int64) (int, int)

FindRange returns the positions where min and max would be inserted into the array. If a[0].UnixNano() > max or a[len-1].UnixNano() < min then FindRange returns (-1, -1) indicating the array is outside the [min, max]. The values must be deduplicated and sorted before calling FindRange or the results are undefined.

func (*FloatArray) Include

func (a *FloatArray) Include(min, max int64)

Include returns the subset values between min and max inclusive. The values must be deduplicated and sorted before calling Include or the results are undefined.

func (*FloatArray) Len

func (a *FloatArray) Len() int

func (*FloatArray) MaxTime

func (a *FloatArray) MaxTime() int64

func (*FloatArray) Merge

func (a *FloatArray) Merge(b *FloatArray)

Merge overlays b to top of a. If two values conflict with the same timestamp, b is used. Both a and b must be sorted in ascending order.

func (*FloatArray) MinTime

func (a *FloatArray) MinTime() int64

func (*FloatArray) Size

func (a *FloatArray) Size() int

type FloatArrayCursor

type FloatArrayCursor interface {
	Cursor
	Next() *FloatArray
}

type Int64Iterator added in v2.0.9

type Int64Iterator interface {
	// Next advances the Int64Iterator to the next value. It returns false when
	// there are no more values.
	Next() bool

	// Value returns the current value.
	Value() int64

	Stats() CursorStats
}

Int64Iterator describes the behavior for enumerating a sequence of int64 values.

var EmptyInt64Iterator Int64Iterator = &int64Iterator{}

EmptyInt64Iterator is an implementation of Int64Iterator that returns no values.

type Int64SliceIterator added in v2.0.9

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

func NewInt64SliceIterator added in v2.0.9

func NewInt64SliceIterator(s []int64) *Int64SliceIterator

func NewInt64SliceIteratorWithStats added in v2.0.9

func NewInt64SliceIteratorWithStats(s []int64, stats CursorStats) *Int64SliceIterator

func (*Int64SliceIterator) Next added in v2.0.9

func (s *Int64SliceIterator) Next() bool

func (*Int64SliceIterator) Stats added in v2.0.9

func (s *Int64SliceIterator) Stats() CursorStats

func (*Int64SliceIterator) Value added in v2.0.9

func (s *Int64SliceIterator) Value() int64

type IntegerArray

type IntegerArray struct {
	Timestamps []int64
	Values     []int64
}

func NewIntegerArrayLen

func NewIntegerArrayLen(sz int) *IntegerArray

func (*IntegerArray) Exclude

func (a *IntegerArray) Exclude(min, max int64)

Exclude removes the subset of values in [min, max]. The values must be deduplicated and sorted before calling Exclude or the results are undefined.

func (*IntegerArray) FindRange

func (a *IntegerArray) FindRange(min, max int64) (int, int)

FindRange returns the positions where min and max would be inserted into the array. If a[0].UnixNano() > max or a[len-1].UnixNano() < min then FindRange returns (-1, -1) indicating the array is outside the [min, max]. The values must be deduplicated and sorted before calling FindRange or the results are undefined.

func (*IntegerArray) Include

func (a *IntegerArray) Include(min, max int64)

Include returns the subset values between min and max inclusive. The values must be deduplicated and sorted before calling Include or the results are undefined.

func (*IntegerArray) Len

func (a *IntegerArray) Len() int

func (*IntegerArray) MaxTime

func (a *IntegerArray) MaxTime() int64

func (*IntegerArray) Merge

func (a *IntegerArray) Merge(b *IntegerArray)

Merge overlays b to top of a. If two values conflict with the same timestamp, b is used. Both a and b must be sorted in ascending order.

func (*IntegerArray) MinTime

func (a *IntegerArray) MinTime() int64

func (*IntegerArray) Size

func (a *IntegerArray) Size() int

type IntegerArrayCursor

type IntegerArrayCursor interface {
	Cursor
	Next() *IntegerArray
}

type MeasurementField

type MeasurementField struct {
	Key       string    // Key is the name of the field
	Type      FieldType // Type is field type
	Timestamp int64     // Timestamp refers to the maximum timestamp observed for the given field
}

func MeasurementFieldsIteratorFlatMap

func MeasurementFieldsIteratorFlatMap(i MeasurementFieldsIterator) []MeasurementField

MeasurementFieldsIteratorFlatMap reads the remainder of i, flattening the results to a single slice.

type MeasurementFieldSlice

type MeasurementFieldSlice []MeasurementField

MeasurementFieldSlice implements sort.Interface and sorts the slice from lowest to highest precedence. Use sort.Reverse to sort from highest to lowest.

func (MeasurementFieldSlice) Len

func (m MeasurementFieldSlice) Len() int

func (MeasurementFieldSlice) Less

func (m MeasurementFieldSlice) Less(i, j int) bool

func (MeasurementFieldSlice) Swap

func (m MeasurementFieldSlice) Swap(i, j int)

func (*MeasurementFieldSlice) UniqueByKey

func (m *MeasurementFieldSlice) UniqueByKey()

UniqueByKey performs an in-place update of m, removing duplicate elements by Key, keeping the first occurrence of each. If the slice is not sorted, the behavior of UniqueByKey is undefined.

type MeasurementFields

type MeasurementFields struct {
	Fields []MeasurementField
}

type MeasurementFieldsIterator

type MeasurementFieldsIterator interface {
	// Next advances the iterator to the next value. It returns false
	// when there are no more values.
	Next() bool

	// Value returns the current value.
	Value() MeasurementFields

	Stats() CursorStats
}

type MeasurementFieldsSliceIterator

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

func NewMeasurementFieldsSliceIterator

func NewMeasurementFieldsSliceIterator(f []MeasurementFields) *MeasurementFieldsSliceIterator

func NewMeasurementFieldsSliceIteratorWithStats

func NewMeasurementFieldsSliceIteratorWithStats(f []MeasurementFields, stats CursorStats) *MeasurementFieldsSliceIterator

func (*MeasurementFieldsSliceIterator) Next

func (*MeasurementFieldsSliceIterator) Stats

func (*MeasurementFieldsSliceIterator) Value

type StringArray

type StringArray struct {
	Timestamps []int64
	Values     []string
}

func NewStringArrayLen

func NewStringArrayLen(sz int) *StringArray

func (*StringArray) Exclude

func (a *StringArray) Exclude(min, max int64)

Exclude removes the subset of values in [min, max]. The values must be deduplicated and sorted before calling Exclude or the results are undefined.

func (*StringArray) FindRange

func (a *StringArray) FindRange(min, max int64) (int, int)

FindRange returns the positions where min and max would be inserted into the array. If a[0].UnixNano() > max or a[len-1].UnixNano() < min then FindRange returns (-1, -1) indicating the array is outside the [min, max]. The values must be deduplicated and sorted before calling FindRange or the results are undefined.

func (*StringArray) Include

func (a *StringArray) Include(min, max int64)

Include returns the subset values between min and max inclusive. The values must be deduplicated and sorted before calling Include or the results are undefined.

func (*StringArray) Len

func (a *StringArray) Len() int

func (*StringArray) MaxTime

func (a *StringArray) MaxTime() int64

func (*StringArray) Merge

func (a *StringArray) Merge(b *StringArray)

Merge overlays b to top of a. If two values conflict with the same timestamp, b is used. Both a and b must be sorted in ascending order.

func (*StringArray) MinTime

func (a *StringArray) MinTime() int64

func (*StringArray) Size

func (a *StringArray) Size() int

type StringArrayCursor

type StringArrayCursor interface {
	Cursor
	Next() *StringArray
}

type StringIterator

type StringIterator interface {
	// Next advances the StringIterator to the next value. It returns false
	// when there are no more values.
	Next() bool

	// Value returns the current value.
	Value() string

	Stats() CursorStats
}

StringIterator describes the behavior for enumerating a sequence of string values.

var EmptyStringIterator StringIterator = &stringIterator{}

EmptyStringIterator is an implementation of StringIterator that returns no values.

type StringSliceIterator

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

func NewStringSliceIterator

func NewStringSliceIterator(s []string) *StringSliceIterator

func NewStringSliceIteratorWithStats

func NewStringSliceIteratorWithStats(s []string, stats CursorStats) *StringSliceIterator

func (*StringSliceIterator) Next

func (s *StringSliceIterator) Next() bool

func (*StringSliceIterator) Stats

func (s *StringSliceIterator) Stats() CursorStats

func (*StringSliceIterator) Value

func (s *StringSliceIterator) Value() string

type TimestampArray

type TimestampArray struct {
	Timestamps []int64
}

func NewTimestampArrayLen

func NewTimestampArrayLen(sz int) *TimestampArray

func (*TimestampArray) Contains

func (a *TimestampArray) Contains(min, max int64) bool

Contains returns true if values exist between min and max inclusive. The values must be sorted before calling Contains or the results are undefined.

func (*TimestampArray) Exclude

func (a *TimestampArray) Exclude(min, max int64)

Exclude removes the subset of timestamps in [min, max]. The timestamps must be deduplicated and sorted before calling Exclude or the results are undefined.

func (*TimestampArray) FindRange

func (a *TimestampArray) FindRange(min, max int64) (int, int)

FindRange returns the positions where min and max would be inserted into the array. If a[0].UnixNano() > max or a[len-1].UnixNano() < min then FindRange returns (-1, -1) indicating the array is outside the [min, max]. The values must be deduplicated and sorted before calling FindRange or the results are undefined.

func (*TimestampArray) Len

func (a *TimestampArray) Len() int

func (*TimestampArray) MaxTime

func (a *TimestampArray) MaxTime() int64

func (*TimestampArray) MinTime

func (a *TimestampArray) MinTime() int64

type UnsignedArray

type UnsignedArray struct {
	Timestamps []int64
	Values     []uint64
}

func NewUnsignedArrayLen

func NewUnsignedArrayLen(sz int) *UnsignedArray

func (*UnsignedArray) Exclude

func (a *UnsignedArray) Exclude(min, max int64)

Exclude removes the subset of values in [min, max]. The values must be deduplicated and sorted before calling Exclude or the results are undefined.

func (*UnsignedArray) FindRange

func (a *UnsignedArray) FindRange(min, max int64) (int, int)

FindRange returns the positions where min and max would be inserted into the array. If a[0].UnixNano() > max or a[len-1].UnixNano() < min then FindRange returns (-1, -1) indicating the array is outside the [min, max]. The values must be deduplicated and sorted before calling FindRange or the results are undefined.

func (*UnsignedArray) Include

func (a *UnsignedArray) Include(min, max int64)

Include returns the subset values between min and max inclusive. The values must be deduplicated and sorted before calling Include or the results are undefined.

func (*UnsignedArray) Len

func (a *UnsignedArray) Len() int

func (*UnsignedArray) MaxTime

func (a *UnsignedArray) MaxTime() int64

func (*UnsignedArray) Merge

func (a *UnsignedArray) Merge(b *UnsignedArray)

Merge overlays b to top of a. If two values conflict with the same timestamp, b is used. Both a and b must be sorted in ascending order.

func (*UnsignedArray) MinTime

func (a *UnsignedArray) MinTime() int64

func (*UnsignedArray) Size

func (a *UnsignedArray) Size() int

type UnsignedArrayCursor

type UnsignedArrayCursor interface {
	Cursor
	Next() *UnsignedArray
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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