cursors

package
v2.0.0-beta.14 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 5 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 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 CursorRequest

type CursorRequest struct {
	Name      []byte
	Tags      models.Tags
	Field     string
	Ascending bool
	StartTime int64
	EndTime   int64
}

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 (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 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 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) Less

func (a *TimestampArray) Less(i, j int) bool

func (*TimestampArray) MaxTime

func (a *TimestampArray) MaxTime() int64

func (*TimestampArray) MinTime

func (a *TimestampArray) MinTime() int64

func (*TimestampArray) Swap

func (a *TimestampArray) Swap(i, j int)

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
}

Jump to

Keyboard shortcuts

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