utils

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DedupeMetadata

func DedupeMetadata(
	seriesMeta []block.SeriesMeta,
	tagOptions models.TagOptions,
) (models.Tags, []block.SeriesMeta)

DedupeMetadata applies all shared tags from Metadata to each SeriesMeta

func FlattenMetadata

func FlattenMetadata(
	meta block.Metadata,
	seriesMeta []block.SeriesMeta,
) []block.SeriesMeta

FlattenMetadata applies all shared tags from Metadata to each SeriesMeta

func FormatFloat added in v0.4.3

func FormatFloat(
	value float64,
) string

FormatFloat converts float values to formatted strings

func FormatFloatToBytes added in v0.4.6

func FormatFloatToBytes(
	value float64,
) []byte

FormatFloatToBytes converts float values to formatted byte arrays

func GreaterWithNaNs added in v1.0.0

func GreaterWithNaNs(i, j float64) bool

Compares two float64 values which one is greater with NaNs. NaNs are always sorted away.

func GroupSeries

func GroupSeries(
	matchingTags [][]byte,
	without bool,
	opName []byte,
	metas []block.SeriesMeta,
) ([][]int, []block.SeriesMeta)

GroupSeries groups series by tags. It gives a list of seriesMeta for the grouped series, and a list of corresponding buckets which signify which series are mapped to which grouped outputs

func LesserWithNaNs added in v1.0.0

func LesserWithNaNs(i, j float64) bool

Compares two float64 values which one is lesser with NaNs. NaNs are always sorted away.

func UniqueCount added in v0.4.8

func UniqueCount(names []string) int

UniqueCount calculates the number of unique strings in a given slice.

Types

type FloatHeap added in v0.4.3

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

FloatHeap is a heap that can be given a maximum size

func NewFloatHeap added in v0.4.3

func NewFloatHeap(isMaxHeap bool, capacity int) FloatHeap

NewFloatHeap builds a new FloatHeap based on first parameter and a capacity given by second parameter. Zero and negative values for maxSize provide an unbounded FloatHeap

func (*FloatHeap) Cap added in v0.4.3

func (fh *FloatHeap) Cap() int

Cap returns the capacity of the heap

func (*FloatHeap) Flush added in v0.4.3

func (fh *FloatHeap) Flush() []ValueIndexPair

Flush flushes the float heap and resets it. Does not guarantee order.

func (*FloatHeap) Len added in v0.4.3

func (fh *FloatHeap) Len() int

Len returns the current length of the heap

func (*FloatHeap) OrderedFlush added in v1.0.0

func (fh *FloatHeap) OrderedFlush() []ValueIndexPair

OrderedFlush flushes the float heap and returns values in order.

func (*FloatHeap) Peek added in v0.4.3

func (fh *FloatHeap) Peek() (ValueIndexPair, bool)

Peek reveals the top value of the heap without mutating the heap.

func (*FloatHeap) Push added in v0.4.3

func (fh *FloatHeap) Push(value float64, index int)

Push pushes a value and index pair to the heap

func (*FloatHeap) Reset added in v0.4.3

func (fh *FloatHeap) Reset()

Reset resets the heap

type StaticParams added in v0.7.0

type StaticParams string

StaticParams is a simple string Params implementation, useful for when no data other than OpType is needed.

func (StaticParams) OpType added in v0.7.0

func (s StaticParams) OpType() string

OpType simply returns s for StaticParams.

func (StaticParams) String added in v0.7.0

func (s StaticParams) String() string

String simply returns s.

type ValueIndexPair added in v0.4.3

type ValueIndexPair struct {
	Val   float64
	Index int
}

ValueIndexPair is a pair of float value and index at which it exists

Jump to

Keyboard shortcuts

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