utils

package
v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

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

func FormatFloat(
	value float64,
) string

FormatFloat converts float values to formatted strings

func FormatFloatToBytes

func FormatFloatToBytes(
	value float64,
) []byte

FormatFloatToBytes converts float values to formatted byte arrays

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 UniqueCount

func UniqueCount(names []string) int

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

Types

type FloatHeap

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

FloatHeap is a heap that can be given a maximum size

func NewFloatHeap

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

func (fh FloatHeap) Cap() int

Cap returns the capacity of the heap

func (FloatHeap) Flush

func (fh FloatHeap) Flush() []ValueIndexPair

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

func (FloatHeap) Len

func (fh FloatHeap) Len() int

Len returns the current length of the heap

func (FloatHeap) Peek

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

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

func (FloatHeap) Push

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

Push pushes a value and index pair to the heap

func (*FloatHeap) Reset

func (fh *FloatHeap) Reset()

Reset resets the heap

type StaticParams

type StaticParams string

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

func (StaticParams) OpType

func (s StaticParams) OpType() string

OpType simply returns s for StaticParams.

func (StaticParams) String

func (s StaticParams) String() string

String simply returns s.

type ValueIndexPair

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