cursors

package
Version: v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxPointsPerBlock = 1000

Variables

This section is empty.

Functions

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      []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 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 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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL