tsdb

package
v2.0.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeName

func DecodeName(name [16]byte) (org, bucket influxdb.ID)

DecodeName converts tsdb internal serialization back to organization and bucket IDs.

func DecodeNameSlice

func DecodeNameSlice(name []byte) (org, bucket influxdb.ID)

DecodeNameSlice converts tsdb internal serialization back to organization and bucket IDs.

func EncodeName

func EncodeName(org, bucket influxdb.ID) [16]byte

EncodeName converts org/bucket pairs to the tsdb internal serialization

func EncodeNameSlice

func EncodeNameSlice(org, bucket influxdb.ID) []byte

EncodeNameSlice converts org/bucket pairs to the tsdb internal serialization but returns a byte slice.

func EncodeNameString

func EncodeNameString(org, bucket influxdb.ID) string

EncodeNameString converts org/bucket pairs to the tsdb internal serialization

func EncodeOrgName

func EncodeOrgName(org influxdb.ID) [8]byte

EncodeOrgName converts org to the tsdb internal serialization that may be used as a prefix when searching for keys matching a specific organization.

func ExplodePoints

func ExplodePoints(org, bucket influxdb.ID, points []models.Point) ([]models.Point, error)

ExplodePoints creates a list of points that only contains one field per point. It also moves the measurement to a tag, and changes the measurement to be the provided argument.

func MakeTagsKey

func MakeTagsKey(keys []string, tags models.Tags) []byte

MakeTagsKey converts a tag set to bytes for use as a lookup key.

Types

type MeasurementIterator

type MeasurementIterator interface {
	Close() error
	Next() ([]byte, error)
}

MeasurementIterator represents a iterator over a list of measurements.

func MergeMeasurementIterators

func MergeMeasurementIterators(itrs ...MeasurementIterator) MeasurementIterator

MergeMeasurementIterators returns an iterator that merges a set of iterators. Iterators that are first in the list take precedence and a deletion by those early iterators will invalidate elements by later iterators.

type PartialWriteError

type PartialWriteError struct {
	Reason  string
	Dropped int

	// A sorted slice of series keys that were dropped.
	DroppedKeys [][]byte
}

PartialWriteError indicates a write request could only write a portion of the requested values.

func (PartialWriteError) Error

func (e PartialWriteError) Error() string

type SeriesCollection

type SeriesCollection struct {
	Points     []models.Point
	Keys       [][]byte
	SeriesKeys [][]byte
	Names      [][]byte
	Tags       []models.Tags
	Types      []models.FieldType
	SeriesIDs  []SeriesID

	// Keeps track of invalid entries.
	Dropped     uint64
	DroppedKeys [][]byte
	Reason      string
	// contains filtered or unexported fields
}

SeriesCollection is a struct of arrays representation of a collection of series that allows for efficient filtering.

func NewSeriesCollection

func NewSeriesCollection(points []models.Point) *SeriesCollection

NewSeriesCollection builds a SeriesCollection from a slice of points. It does some filtering of invalid points.

func (*SeriesCollection) Advance

func (s *SeriesCollection) Advance(length int)

Advance will advance all of the slices that can length elements: x = x[length:].

func (*SeriesCollection) ApplyConcurrentDrops

func (s *SeriesCollection) ApplyConcurrentDrops()

ApplyConcurrentDrops will remove all of the dropped values during concurrent iteration. It should not be called concurrently with any calls to Invalid.

func (*SeriesCollection) Copy

func (s *SeriesCollection) Copy(dst, src int)

Copy will copy the element at src into dst in all slices that can: x[dst] = x[src].

func (SeriesCollection) Duplicate

func (s SeriesCollection) Duplicate() *SeriesCollection

Duplicate returns a copy of the SeriesCollection. The slices are shared. Appending to any of them may or may not be reflected.

func (*SeriesCollection) InvalidateAll

func (s *SeriesCollection) InvalidateAll(reason string)

InvalidateAll causes all of the entries to become invalid.

func (*SeriesCollection) Iterator

Iterator returns a new iterator over the entries in the collection. Multiple iterators can exist at the same time. Marking entries as invalid/skipped is more expensive, but thread safe. You must call ApplyConcurrentDrops after all of the iterators are finished.

func (*SeriesCollection) Length

func (s *SeriesCollection) Length() int

Length returns the length of the first non-nil slice in the collection, or 0 if there is no non-nil slice.

func (*SeriesCollection) PartialWriteError

func (s *SeriesCollection) PartialWriteError() error

PartialWriteError returns a PartialWriteError if any entries have been marked as invalid. It returns an error to avoid `return collection.PartialWriteError()` always being non-nil.

func (*SeriesCollection) Swap

func (s *SeriesCollection) Swap(i, j int)

Swap will swap the elements at i and j in all slices that can: x[i], x[j] = x[j], x[i].

func (*SeriesCollection) Truncate

func (s *SeriesCollection) Truncate(length int)

Truncate will truncate all of the slices that can down to length: x = x[:length].

type SeriesCollectionIterator

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

SeriesCollectionIterator is an iterator over the collection of series.

func (SeriesCollectionIterator) Index

func (i SeriesCollectionIterator) Index() int

func (*SeriesCollectionIterator) Invalid

func (i *SeriesCollectionIterator) Invalid(reason string)

Invalid flags the current entry as invalid, including it in the set of dropped keys and recording a reason. Only the first reason is kept. This is safe for concurrent callers, but ApplyConcurrentDrops must be called after all iterators are finished.

func (SeriesCollectionIterator) Key

func (i SeriesCollectionIterator) Key() []byte

func (SeriesCollectionIterator) Length

func (i SeriesCollectionIterator) Length() int

func (SeriesCollectionIterator) Name

func (i SeriesCollectionIterator) Name() []byte

func (*SeriesCollectionIterator) Next

func (i *SeriesCollectionIterator) Next() bool

Next advances the iterator and returns false if it's done.

func (SeriesCollectionIterator) Point

func (SeriesCollectionIterator) SeriesID

func (i SeriesCollectionIterator) SeriesID() SeriesID

func (SeriesCollectionIterator) SeriesKey

func (i SeriesCollectionIterator) SeriesKey() []byte

func (SeriesCollectionIterator) Tags

func (SeriesCollectionIterator) Type

type SeriesID

type SeriesID struct{ ID uint64 }

SeriesID is the type of a series id. It is logically a uint64, but encoded as a struct so that we gain more type checking when changing operations on it. The field is exported only so that tests that use reflection based comparisons still work; no one should use the field directly.

func NewSeriesID

func NewSeriesID(id uint64) SeriesID

NewSeriesID constructs a series id from the raw value. It discards any type information.

func (SeriesID) Greater

func (s SeriesID) Greater(o SeriesID) bool

Greater returns if the SeriesID is greater than the passed in value.

func (SeriesID) IsZero

func (s SeriesID) IsZero() bool

IsZero returns if the SeriesID is zero.

func (SeriesID) Less

func (s SeriesID) Less(o SeriesID) bool

Less returns if the SeriesID is less than the passed in value.

func (SeriesID) RawID

func (s SeriesID) RawID() uint64

ID returns the raw id for the SeriesID.

func (SeriesID) WithType

func (s SeriesID) WithType(typ models.FieldType) SeriesIDTyped

WithType constructs a SeriesIDTyped with the given type.

type SeriesIDElem

type SeriesIDElem struct {
	SeriesID SeriesID
	Expr     influxql.Expr
}

SeriesIDElem represents a single series and optional expression.

type SeriesIDExprIterator

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

seriesIDExprIterator is an iterator that attaches an associated expression.

func (*SeriesIDExprIterator) Close

func (itr *SeriesIDExprIterator) Close() error

func (*SeriesIDExprIterator) Next

func (itr *SeriesIDExprIterator) Next() (SeriesIDElem, error)

Next returns the next element in the iterator.

type SeriesIDIterator

type SeriesIDIterator interface {
	Next() (SeriesIDElem, error)
	Close() error
}

SeriesIDIterator represents a iterator over a list of series ids.

func DifferenceSeriesIDIterators

func DifferenceSeriesIDIterators(itr0, itr1 SeriesIDIterator) SeriesIDIterator

DifferenceSeriesIDIterators returns an iterator that only returns series which occur the first iterator but not the second iterator.

func IntersectSeriesIDIterators

func IntersectSeriesIDIterators(itr0, itr1 SeriesIDIterator) SeriesIDIterator

IntersectSeriesIDIterators returns an iterator that only returns series which occur in both iterators. If both series have associated expressions then they are combined together.

func MergeSeriesIDIterators

func MergeSeriesIDIterators(itrs ...SeriesIDIterator) SeriesIDIterator

MergeSeriesIDIterators returns an iterator that merges a set of iterators. Iterators that are first in the list take precedence and a deletion by those early iterators will invalidate elements by later iterators.

func NewSeriesIDExprIterator

func NewSeriesIDExprIterator(itr SeriesIDIterator, expr influxql.Expr) SeriesIDIterator

newSeriesIDExprIterator returns a new instance of seriesIDExprIterator.

func UnionSeriesIDIterators

func UnionSeriesIDIterators(itr0, itr1 SeriesIDIterator) SeriesIDIterator

UnionSeriesIDIterators returns an iterator that returns series from both both iterators. If both series have associated expressions then they are combined together.

type SeriesIDIterators

type SeriesIDIterators []SeriesIDIterator

func (SeriesIDIterators) Close

func (a SeriesIDIterators) Close() (err error)

type SeriesIDSet

type SeriesIDSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SeriesIDSet represents a lockable bitmap of series ids.

func NewSeriesIDSet

func NewSeriesIDSet(a ...SeriesID) *SeriesIDSet

NewSeriesIDSet returns a new instance of SeriesIDSet.

func NewSeriesIDSetNegate

func NewSeriesIDSetNegate(a, b *SeriesIDSet) *SeriesIDSet

NewSeriesIDSetNegate returns a new SeriesIDSet containing all the elements in a that are not present in b. That is, the set difference between a and b.

func (*SeriesIDSet) Add

func (s *SeriesIDSet) Add(id SeriesID)

Add adds the series id to the set.

func (*SeriesIDSet) AddMany

func (s *SeriesIDSet) AddMany(ids ...SeriesID)

AddMany adds multiple ids to the SeriesIDSet. AddMany takes a lock, so may not be optimal to call many times with few ids.

func (*SeriesIDSet) AddNoLock

func (s *SeriesIDSet) AddNoLock(id SeriesID)

AddNoLock adds the series id to the set. Add is not safe for use from multiple goroutines. Callers must manage synchronization.

func (*SeriesIDSet) And

func (s *SeriesIDSet) And(other *SeriesIDSet) *SeriesIDSet

And returns a new SeriesIDSet containing elements that were present in s and other.

func (*SeriesIDSet) Bytes

func (s *SeriesIDSet) Bytes() int

Bytes estimates the memory footprint of this SeriesIDSet, in bytes.

func (*SeriesIDSet) Cardinality

func (s *SeriesIDSet) Cardinality() uint64

Cardinality returns the cardinality of the SeriesIDSet.

func (*SeriesIDSet) Clear

func (s *SeriesIDSet) Clear()

Clear clears the underlying bitmap for re-use. Clear is safe for use by multiple goroutines.

func (*SeriesIDSet) ClearNoLock

func (s *SeriesIDSet) ClearNoLock()

ClearNoLock clears the underlying bitmap for re-use without taking a lock.

func (*SeriesIDSet) Clone

func (s *SeriesIDSet) Clone() *SeriesIDSet

Clone returns a new SeriesIDSet with a deep copy of the underlying bitmap.

func (*SeriesIDSet) CloneNoLock

func (s *SeriesIDSet) CloneNoLock() *SeriesIDSet

CloneNoLock calls Clone without taking a lock.

func (*SeriesIDSet) Contains

func (s *SeriesIDSet) Contains(id SeriesID) bool

Contains returns true if the id exists in the set.

func (*SeriesIDSet) ContainsNoLock

func (s *SeriesIDSet) ContainsNoLock(id SeriesID) bool

ContainsNoLock returns true if the id exists in the set. ContainsNoLock is not safe for use from multiple goroutines. The caller must manage synchronization.

func (*SeriesIDSet) Diff

func (s *SeriesIDSet) Diff(other *SeriesIDSet)

Diff removes from s any elements also present in other.

func (*SeriesIDSet) Equals

func (s *SeriesIDSet) Equals(other *SeriesIDSet) bool

Equals returns true if other and s are the same set of ids.

func (*SeriesIDSet) ForEach

func (s *SeriesIDSet) ForEach(f func(id SeriesID))

ForEach calls f for each id in the set. The function is applied to the IDs in ascending order.

func (*SeriesIDSet) ForEachNoLock

func (s *SeriesIDSet) ForEachNoLock(f func(id SeriesID))

ForEachNoLock calls f for each id in the set without taking a lock.

func (*SeriesIDSet) Iterator

func (s *SeriesIDSet) Iterator() SeriesIDSetIterable

Iterator returns an iterator to the underlying bitmap. This iterator is not protected by a lock.

func (*SeriesIDSet) Merge

func (s *SeriesIDSet) Merge(others ...*SeriesIDSet)

Merge merged the contents of others into s. The caller does not need to provide s as an argument, and the contents of s will always be present in s after Merge returns.

func (*SeriesIDSet) MergeInPlace

func (s *SeriesIDSet) MergeInPlace(other *SeriesIDSet)

MergeInPlace merges other into s, modifying s in the process.

func (*SeriesIDSet) Remove

func (s *SeriesIDSet) Remove(id SeriesID)

Remove removes the id from the set.

func (*SeriesIDSet) RemoveNoLock

func (s *SeriesIDSet) RemoveNoLock(id SeriesID)

RemoveNoLock removes the id from the set. RemoveNoLock is not safe for use from multiple goroutines. The caller must manage synchronization.

func (*SeriesIDSet) RemoveSet

func (s *SeriesIDSet) RemoveSet(other *SeriesIDSet)

RemoveSet removes all values in other from s, if they exist.

func (*SeriesIDSet) Slice

func (s *SeriesIDSet) Slice() []uint64

Slice returns a slice of series ids.

func (*SeriesIDSet) String

func (s *SeriesIDSet) String() string

func (*SeriesIDSet) UnmarshalBinary

func (s *SeriesIDSet) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals data into the set.

func (*SeriesIDSet) UnmarshalBinaryUnsafe

func (s *SeriesIDSet) UnmarshalBinaryUnsafe(data []byte) error

UnmarshalBinaryUnsafe unmarshals data into the set. References to the underlying data are used so data should not be reused by caller.

func (*SeriesIDSet) WriteTo

func (s *SeriesIDSet) WriteTo(w io.Writer) (int64, error)

WriteTo writes the set to w.

type SeriesIDSetIterable

type SeriesIDSetIterable interface {
	HasNext() bool
	Next() uint32
}

type SeriesIDSetIterator

type SeriesIDSetIterator interface {
	SeriesIDIterator
	SeriesIDSet() *SeriesIDSet
}

SeriesIDSetIterator represents an iterator that can produce a SeriesIDSet.

func NewSeriesIDSetIterator

func NewSeriesIDSetIterator(ss *SeriesIDSet) SeriesIDSetIterator

func NewSeriesIDSetIterators

func NewSeriesIDSetIterators(itrs []SeriesIDIterator) []SeriesIDSetIterator

NewSeriesIDSetIterators returns a slice of SeriesIDSetIterator if all itrs can be type casted. Otherwise returns nil.

type SeriesIDSliceIterator

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

SeriesIDSliceIterator iterates over a slice of series ids.

func NewSeriesIDSliceIterator

func NewSeriesIDSliceIterator(ids []SeriesID) *SeriesIDSliceIterator

NewSeriesIDSliceIterator returns a SeriesIDIterator that iterates over a slice.

func (*SeriesIDSliceIterator) Close

func (itr *SeriesIDSliceIterator) Close() error

func (*SeriesIDSliceIterator) Next

func (itr *SeriesIDSliceIterator) Next() (SeriesIDElem, error)

Next returns the next series id in the slice.

func (*SeriesIDSliceIterator) SeriesIDSet

func (itr *SeriesIDSliceIterator) SeriesIDSet() *SeriesIDSet

SeriesIDSet returns a set of all remaining ids.

type SeriesIDTyped

type SeriesIDTyped struct{ ID uint64 }

SeriesIDType represents a series id with a type. It is logically a uint64, but encoded as a struct so that we gain more type checking when changing operations on it. The field is exported only so that tests that use reflection based comparisons still work; no one should use the field directly.

func NewSeriesIDTyped

func NewSeriesIDTyped(id uint64) SeriesIDTyped

NewSeriesIDTyped constructs a typed series id from the raw values.

func (SeriesIDTyped) HasType

func (s SeriesIDTyped) HasType() bool

HasType returns if the id actually contains a type.

func (SeriesIDTyped) IsZero

func (s SeriesIDTyped) IsZero() bool

IsZero returns if the SeriesIDTyped is zero. It ignores any type information.

func (SeriesIDTyped) RawID

func (s SeriesIDTyped) RawID() uint64

ID returns the raw id for the SeriesIDTyped.

func (SeriesIDTyped) SeriesID

func (s SeriesIDTyped) SeriesID() SeriesID

SeriesID constructs a SeriesID, discarding any type information.

func (SeriesIDTyped) Type

func (s SeriesIDTyped) Type() models.FieldType

Type returns the associated type.

type TagKeyIterator

type TagKeyIterator interface {
	Close() error
	Next() ([]byte, error)
}

TagKeyIterator represents a iterator over a list of tag keys.

func MergeTagKeyIterators

func MergeTagKeyIterators(itrs ...TagKeyIterator) TagKeyIterator

MergeTagKeyIterators returns an iterator that merges a set of iterators.

type TagValueIterator

type TagValueIterator interface {
	Close() error
	Next() ([]byte, error)
}

TagValueIterator represents a iterator over a list of tag values.

func MergeTagValueIterators

func MergeTagValueIterators(itrs ...TagValueIterator) TagValueIterator

MergeTagValueIterators returns an iterator that merges a set of iterators.

Directories

Path Synopsis
Package migrate provides tooling to migrate data from InfluxDB 1.x to 2.x
Package migrate provides tooling to migrate data from InfluxDB 1.x to 2.x
internal
Package meta is a generated protocol buffer package.
Package meta is a generated protocol buffer package.
Package tsi1 provides a memory-mapped index implementation that supports high cardinality series.
Package tsi1 provides a memory-mapped index implementation that supports high cardinality series.
Package tsm1 provides a TSDB in the Time Structured Merge tree format.
Package tsm1 provides a TSDB in the Time Structured Merge tree format.

Jump to

Keyboard shortcuts

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