block

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: 13 Imported by: 0

Documentation

Overview

Package block is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TakeLast

func TakeLast(values ts.Datapoints) float64

TakeLast is a consolidation function which takes the last datapoint which has non nan value.

Types

type AccountedBlock

type AccountedBlock struct {
	Block
	// contains filtered or unexported fields
}

AccountedBlock is a wrapper for a block which enforces limits on the number of datapoints used by the block.

func NewAccountedBlock

func NewAccountedBlock(
	wrapped Block,
	enforcer cost.ChainedEnforcer,
) *AccountedBlock

NewAccountedBlock wraps the given block and enforces datapoint limits.

func (*AccountedBlock) Close

func (ab *AccountedBlock) Close() error

Close closes the block, and marks the number of datapoints used by this block as finished.

type AccumulatorBlock

type AccumulatorBlock interface {
	Block
	// AddBlock adds a block to this accumulator.
	AddBlock(bl Block) error
}

func NewContainerBlock

func NewContainerBlock(blocks ...Block) (AccumulatorBlock, error)

NewContainerBlock creates a container block, which allows iterating across blocks incoming from multiple data sources, provided they have the same bounds.

type Block

type Block interface {
	io.Closer
	// Unconsolidated returns the unconsolidated version of the block.
	Unconsolidated() (UnconsolidatedBlock, error)
	// StepIter returns a step-wise block iterator, giving consolidated values
	// across all series comprising the box at a single time step.
	StepIter() (StepIter, error)
	// SeriesIter returns a series-wise block iterator, giving consolidated values
	// by series.
	SeriesIter() (SeriesIter, error)
	// Meta returns the metadata for the block.
	Meta() Metadata
	// Info returns information about the block.
	Info() BlockInfo
}

Block represents a group of series across a time bound.

func NewEmptyBlock

func NewEmptyBlock(meta Metadata) Block

NewEmptyBlock creates an empty block with the given metadata.

func NewLazyBlock

func NewLazyBlock(block Block, opts LazyOptions) Block

NewLazyBlock creates a lazy block wrapping another block with lazy options.

func NewScalar

func NewScalar(
	val float64,
	meta Metadata,
) Block

NewScalar creates a scalar block whose value is given by the function over the metadata bounds.

type BlockInfo

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

func NewBlockInfo

func NewBlockInfo(blockType BlockType) BlockInfo

func NewWrappedBlockInfo

func NewWrappedBlockInfo(
	blockType BlockType,
	wrap BlockInfo,
) BlockInfo

func (BlockInfo) BaseType

func (b BlockInfo) BaseType() BlockType

func (BlockInfo) InnerType

func (b BlockInfo) InnerType() BlockType

func (BlockInfo) Type

func (b BlockInfo) Type() BlockType

type BlockType

type BlockType uint8

BlockType describes a block type.

const (
	// BlockM3TSZCompressed is an M3TSZ compressed block.
	BlockM3TSZCompressed BlockType = iota
	// BlockDecompressed is a decompressed raw data block.
	BlockDecompressed
	// BlockScalar is a scalar block with a single value throughout its range.
	BlockScalar
	// BlockTime is a block with datapoint values given by a function of their
	// timestamps.
	BlockTime
	// BlockLazy is a wrapper for an inner block that lazily applies transforms.
	BlockLazy
	// BlockContainer is a block that contains multiple inner blocks that share
	// common metadata.
	BlockContainer
	// BlockEmpty is a block with metadata but no series or values.
	BlockEmpty
	//
	// TODO: (arnikola) do some refactoring to remove the blocks and types below,
	// as they can be better handled by the above block types.
	//
	// BlockMultiSeries is a block containing series with common metadata.
	BlockMultiSeries
	// BlockConsolidated is a consolidated block.
	BlockConsolidated
)

func (BlockType) String

func (t BlockType) String() string

type Builder

type Builder interface {
	// AddCols adds the given number of columns to the block.
	AddCols(num int) error
	// AppendValue adds a single value to the column at the given index.
	AppendValue(idx int, value float64) error
	// AppendValues adds a slice of values to the column at the given index.
	AppendValues(idx int, values []float64) error
	// Build builds the block.
	Build() Block
	// BuildAsType builds the block, forcing it to the given BlockType.
	BuildAsType(blockType BlockType) Block
}

func NewColumnBlockBuilder

func NewColumnBlockBuilder(
	queryCtx *models.QueryContext,
	meta Metadata,
	seriesMeta []SeriesMeta) Builder

NewColumnBlockBuilder creates a new column block builder

type ColStep

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

ColStep is a single column containing data from multiple series at a given time step

func (ColStep) Time

func (c ColStep) Time() time.Time

Time for the step

func (ColStep) Values

func (c ColStep) Values() []float64

Values for the column

type ColumnBlockBuilder

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

ColumnBlockBuilder builds a block optimized for column iteration

func (ColumnBlockBuilder) AddCols

func (cb ColumnBlockBuilder) AddCols(num int) error

func (ColumnBlockBuilder) AppendValue

func (cb ColumnBlockBuilder) AppendValue(idx int, value float64) error

AppendValue adds a value to a column at index

func (ColumnBlockBuilder) AppendValues

func (cb ColumnBlockBuilder) AppendValues(idx int, values []float64) error

AppendValues adds a slice of values to a column at index

func (ColumnBlockBuilder) Build

func (cb ColumnBlockBuilder) Build() Block

func (ColumnBlockBuilder) BuildAsType

func (cb ColumnBlockBuilder) BuildAsType(blockType BlockType) Block

type ConsolidationFunc

type ConsolidationFunc func(datapoints ts.Datapoints) float64

ConsolidationFunc consolidates a bunch of datapoints into a single float value.

type Iterator

type Iterator interface {
	// Next moves to the next item in the iterator. It will return false if there
	// are no more items, or if encountering an error.
	//
	// NB: it is important to check that Err() is nil after Next returns false, to
	// ensure that any errors during iteration are detected and accounted for.
	Next() bool
	// Err returns any error encountered during iteration.
	Err() error
	// Close frees up resources held by the iterator.
	Close()
}

Iterator is the base iterator.

type LazyOptions

type LazyOptions interface {
	// SetTimeTransform sets the time transform function.
	SetTimeTransform(TimeTransform) LazyOptions
	// TimeTransform returns the time transform function.
	TimeTransform() TimeTransform
	// SetValueTransform sets the value transform function.
	SetValueTransform(ValueTransform) LazyOptions
	// ValueTransform returns the value transform function.
	ValueTransform() ValueTransform
	// SetMetaTransform sets the meta transform function.
	SetMetaTransform(MetaTransform) LazyOptions
	// MetaTransform returns the meta transform function.
	MetaTransform() MetaTransform
	// SetSeriesMetaTransform sets the series meta transform function.
	SetSeriesMetaTransform(SeriesMetaTransform) LazyOptions
	// SeriesMetaTransform returns the series meta transform function.
	SeriesMetaTransform() SeriesMetaTransform
}

LazyOptions describes options for lazy blocks.

func NewLazyOptions

func NewLazyOptions() LazyOptions

NewLazyOptions creates LazyOpts with default values.

type MetaTransform

type MetaTransform func(meta Metadata) Metadata

MetaTransform transforms meta data.

type Metadata

type Metadata struct {
	// Bounds represents the time bounds for all series in the block.
	Bounds models.Bounds
	// Tags contains any tags common across all series in the block.
	Tags models.Tags
	// ResultMetadata contains metadata from any database access operations during
	// fetching block details.
	ResultMetadata ResultMetadata
}

Metadata is metadata for a block, describing size and common tags across constituent series.

func MustMakeMeta

func MustMakeMeta(bounds models.Bounds, tags ...string) Metadata

MustMakeMeta returns block metadata or panics (unsafe for use).

func (Metadata) Equals

func (m Metadata) Equals(other Metadata) bool

Equals returns a boolean reporting whether the compared metadata has equal fields.

func (Metadata) String

func (m Metadata) String() string

String returns a string representation of metadata.

type MockBlock

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

MockBlock is a mock of Block interface

func NewMockBlock

func NewMockBlock(ctrl *gomock.Controller) *MockBlock

NewMockBlock creates a new mock instance

func (*MockBlock) Close

func (m *MockBlock) Close() error

Close mocks base method

func (*MockBlock) EXPECT

func (m *MockBlock) EXPECT() *MockBlockMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockBlock) Info

func (m *MockBlock) Info() BlockInfo

Info mocks base method

func (*MockBlock) Meta

func (m *MockBlock) Meta() Metadata

Meta mocks base method

func (*MockBlock) SeriesIter

func (m *MockBlock) SeriesIter() (SeriesIter, error)

SeriesIter mocks base method

func (*MockBlock) StepIter

func (m *MockBlock) StepIter() (StepIter, error)

StepIter mocks base method

func (*MockBlock) Unconsolidated

func (m *MockBlock) Unconsolidated() (UnconsolidatedBlock, error)

Unconsolidated mocks base method

type MockBlockMockRecorder

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

MockBlockMockRecorder is the mock recorder for MockBlock

func (*MockBlockMockRecorder) Close

func (mr *MockBlockMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockBlockMockRecorder) Info

func (mr *MockBlockMockRecorder) Info() *gomock.Call

Info indicates an expected call of Info

func (*MockBlockMockRecorder) Meta

func (mr *MockBlockMockRecorder) Meta() *gomock.Call

Meta indicates an expected call of Meta

func (*MockBlockMockRecorder) SeriesIter

func (mr *MockBlockMockRecorder) SeriesIter() *gomock.Call

SeriesIter indicates an expected call of SeriesIter

func (*MockBlockMockRecorder) StepIter

func (mr *MockBlockMockRecorder) StepIter() *gomock.Call

StepIter indicates an expected call of StepIter

func (*MockBlockMockRecorder) Unconsolidated

func (mr *MockBlockMockRecorder) Unconsolidated() *gomock.Call

Unconsolidated indicates an expected call of Unconsolidated

type MockBuilder

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

MockBuilder is a mock of Builder interface

func NewMockBuilder

func NewMockBuilder(ctrl *gomock.Controller) *MockBuilder

NewMockBuilder creates a new mock instance

func (*MockBuilder) AddCols

func (m *MockBuilder) AddCols(arg0 int) error

AddCols mocks base method

func (*MockBuilder) AppendValue

func (m *MockBuilder) AppendValue(arg0 int, arg1 float64) error

AppendValue mocks base method

func (*MockBuilder) AppendValues

func (m *MockBuilder) AppendValues(arg0 int, arg1 []float64) error

AppendValues mocks base method

func (*MockBuilder) Build

func (m *MockBuilder) Build() Block

Build mocks base method

func (*MockBuilder) BuildAsType

func (m *MockBuilder) BuildAsType(arg0 BlockType) Block

BuildAsType mocks base method

func (*MockBuilder) EXPECT

func (m *MockBuilder) EXPECT() *MockBuilderMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

type MockBuilderMockRecorder

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

MockBuilderMockRecorder is the mock recorder for MockBuilder

func (*MockBuilderMockRecorder) AddCols

func (mr *MockBuilderMockRecorder) AddCols(arg0 interface{}) *gomock.Call

AddCols indicates an expected call of AddCols

func (*MockBuilderMockRecorder) AppendValue

func (mr *MockBuilderMockRecorder) AppendValue(arg0, arg1 interface{}) *gomock.Call

AppendValue indicates an expected call of AppendValue

func (*MockBuilderMockRecorder) AppendValues

func (mr *MockBuilderMockRecorder) AppendValues(arg0, arg1 interface{}) *gomock.Call

AppendValues indicates an expected call of AppendValues

func (*MockBuilderMockRecorder) Build

func (mr *MockBuilderMockRecorder) Build() *gomock.Call

Build indicates an expected call of Build

func (*MockBuilderMockRecorder) BuildAsType

func (mr *MockBuilderMockRecorder) BuildAsType(arg0 interface{}) *gomock.Call

BuildAsType indicates an expected call of BuildAsType

type MockSeriesIter

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

MockSeriesIter is a mock of SeriesIter interface

func NewMockSeriesIter

func NewMockSeriesIter(ctrl *gomock.Controller) *MockSeriesIter

NewMockSeriesIter creates a new mock instance

func (*MockSeriesIter) Close

func (m *MockSeriesIter) Close()

Close mocks base method

func (*MockSeriesIter) Current

func (m *MockSeriesIter) Current() Series

Current mocks base method

func (*MockSeriesIter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockSeriesIter) Err

func (m *MockSeriesIter) Err() error

Err mocks base method

func (*MockSeriesIter) Next

func (m *MockSeriesIter) Next() bool

Next mocks base method

func (*MockSeriesIter) SeriesCount

func (m *MockSeriesIter) SeriesCount() int

SeriesCount mocks base method

func (*MockSeriesIter) SeriesMeta

func (m *MockSeriesIter) SeriesMeta() []SeriesMeta

SeriesMeta mocks base method

type MockSeriesIterMockRecorder

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

MockSeriesIterMockRecorder is the mock recorder for MockSeriesIter

func (*MockSeriesIterMockRecorder) Close

func (mr *MockSeriesIterMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockSeriesIterMockRecorder) Current

func (mr *MockSeriesIterMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current

func (*MockSeriesIterMockRecorder) Err

Err indicates an expected call of Err

func (*MockSeriesIterMockRecorder) Next

Next indicates an expected call of Next

func (*MockSeriesIterMockRecorder) SeriesCount

func (mr *MockSeriesIterMockRecorder) SeriesCount() *gomock.Call

SeriesCount indicates an expected call of SeriesCount

func (*MockSeriesIterMockRecorder) SeriesMeta

func (mr *MockSeriesIterMockRecorder) SeriesMeta() *gomock.Call

SeriesMeta indicates an expected call of SeriesMeta

type MockStep

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

MockStep is a mock of Step interface

func NewMockStep

func NewMockStep(ctrl *gomock.Controller) *MockStep

NewMockStep creates a new mock instance

func (*MockStep) EXPECT

func (m *MockStep) EXPECT() *MockStepMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockStep) Time

func (m *MockStep) Time() time.Time

Time mocks base method

func (*MockStep) Values

func (m *MockStep) Values() []float64

Values mocks base method

type MockStepIter

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

MockStepIter is a mock of StepIter interface

func NewMockStepIter

func NewMockStepIter(ctrl *gomock.Controller) *MockStepIter

NewMockStepIter creates a new mock instance

func (*MockStepIter) Close

func (m *MockStepIter) Close()

Close mocks base method

func (*MockStepIter) Current

func (m *MockStepIter) Current() Step

Current mocks base method

func (*MockStepIter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockStepIter) Err

func (m *MockStepIter) Err() error

Err mocks base method

func (*MockStepIter) Next

func (m *MockStepIter) Next() bool

Next mocks base method

func (*MockStepIter) SeriesMeta

func (m *MockStepIter) SeriesMeta() []SeriesMeta

SeriesMeta mocks base method

func (*MockStepIter) StepCount

func (m *MockStepIter) StepCount() int

StepCount mocks base method

type MockStepIterMockRecorder

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

MockStepIterMockRecorder is the mock recorder for MockStepIter

func (*MockStepIterMockRecorder) Close

func (mr *MockStepIterMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockStepIterMockRecorder) Current

func (mr *MockStepIterMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current

func (*MockStepIterMockRecorder) Err

Err indicates an expected call of Err

func (*MockStepIterMockRecorder) Next

func (mr *MockStepIterMockRecorder) Next() *gomock.Call

Next indicates an expected call of Next

func (*MockStepIterMockRecorder) SeriesMeta

func (mr *MockStepIterMockRecorder) SeriesMeta() *gomock.Call

SeriesMeta indicates an expected call of SeriesMeta

func (*MockStepIterMockRecorder) StepCount

func (mr *MockStepIterMockRecorder) StepCount() *gomock.Call

StepCount indicates an expected call of StepCount

type MockStepMockRecorder

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

MockStepMockRecorder is the mock recorder for MockStep

func (*MockStepMockRecorder) Time

func (mr *MockStepMockRecorder) Time() *gomock.Call

Time indicates an expected call of Time

func (*MockStepMockRecorder) Values

func (mr *MockStepMockRecorder) Values() *gomock.Call

Values indicates an expected call of Values

type MockUnconsolidatedBlock

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

MockUnconsolidatedBlock is a mock of UnconsolidatedBlock interface

func NewMockUnconsolidatedBlock

func NewMockUnconsolidatedBlock(ctrl *gomock.Controller) *MockUnconsolidatedBlock

NewMockUnconsolidatedBlock creates a new mock instance

func (*MockUnconsolidatedBlock) Close

func (m *MockUnconsolidatedBlock) Close() error

Close mocks base method

func (*MockUnconsolidatedBlock) Consolidate

func (m *MockUnconsolidatedBlock) Consolidate() (Block, error)

Consolidate mocks base method

func (*MockUnconsolidatedBlock) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUnconsolidatedBlock) Meta

Meta mocks base method

func (*MockUnconsolidatedBlock) SeriesIter

SeriesIter mocks base method

func (*MockUnconsolidatedBlock) StepIter

StepIter mocks base method

type MockUnconsolidatedBlockMockRecorder

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

MockUnconsolidatedBlockMockRecorder is the mock recorder for MockUnconsolidatedBlock

func (*MockUnconsolidatedBlockMockRecorder) Close

Close indicates an expected call of Close

func (*MockUnconsolidatedBlockMockRecorder) Consolidate

func (mr *MockUnconsolidatedBlockMockRecorder) Consolidate() *gomock.Call

Consolidate indicates an expected call of Consolidate

func (*MockUnconsolidatedBlockMockRecorder) Meta

Meta indicates an expected call of Meta

func (*MockUnconsolidatedBlockMockRecorder) SeriesIter

SeriesIter indicates an expected call of SeriesIter

func (*MockUnconsolidatedBlockMockRecorder) StepIter

StepIter indicates an expected call of StepIter

type MockUnconsolidatedSeriesIter

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

MockUnconsolidatedSeriesIter is a mock of UnconsolidatedSeriesIter interface

func NewMockUnconsolidatedSeriesIter

func NewMockUnconsolidatedSeriesIter(ctrl *gomock.Controller) *MockUnconsolidatedSeriesIter

NewMockUnconsolidatedSeriesIter creates a new mock instance

func (*MockUnconsolidatedSeriesIter) Close

func (m *MockUnconsolidatedSeriesIter) Close()

Close mocks base method

func (*MockUnconsolidatedSeriesIter) Current

Current mocks base method

func (*MockUnconsolidatedSeriesIter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUnconsolidatedSeriesIter) Err

Err mocks base method

func (*MockUnconsolidatedSeriesIter) Next

Next mocks base method

func (*MockUnconsolidatedSeriesIter) SeriesCount

func (m *MockUnconsolidatedSeriesIter) SeriesCount() int

SeriesCount mocks base method

func (*MockUnconsolidatedSeriesIter) SeriesMeta

func (m *MockUnconsolidatedSeriesIter) SeriesMeta() []SeriesMeta

SeriesMeta mocks base method

type MockUnconsolidatedSeriesIterMockRecorder

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

MockUnconsolidatedSeriesIterMockRecorder is the mock recorder for MockUnconsolidatedSeriesIter

func (*MockUnconsolidatedSeriesIterMockRecorder) Close

Close indicates an expected call of Close

func (*MockUnconsolidatedSeriesIterMockRecorder) Current

Current indicates an expected call of Current

func (*MockUnconsolidatedSeriesIterMockRecorder) Err

Err indicates an expected call of Err

func (*MockUnconsolidatedSeriesIterMockRecorder) Next

Next indicates an expected call of Next

func (*MockUnconsolidatedSeriesIterMockRecorder) SeriesCount

SeriesCount indicates an expected call of SeriesCount

func (*MockUnconsolidatedSeriesIterMockRecorder) SeriesMeta

SeriesMeta indicates an expected call of SeriesMeta

type MockUnconsolidatedStep

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

MockUnconsolidatedStep is a mock of UnconsolidatedStep interface

func NewMockUnconsolidatedStep

func NewMockUnconsolidatedStep(ctrl *gomock.Controller) *MockUnconsolidatedStep

NewMockUnconsolidatedStep creates a new mock instance

func (*MockUnconsolidatedStep) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUnconsolidatedStep) Time

func (m *MockUnconsolidatedStep) Time() time.Time

Time mocks base method

func (*MockUnconsolidatedStep) Values

func (m *MockUnconsolidatedStep) Values() []ts.Datapoints

Values mocks base method

type MockUnconsolidatedStepIter

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

MockUnconsolidatedStepIter is a mock of UnconsolidatedStepIter interface

func NewMockUnconsolidatedStepIter

func NewMockUnconsolidatedStepIter(ctrl *gomock.Controller) *MockUnconsolidatedStepIter

NewMockUnconsolidatedStepIter creates a new mock instance

func (*MockUnconsolidatedStepIter) Close

func (m *MockUnconsolidatedStepIter) Close()

Close mocks base method

func (*MockUnconsolidatedStepIter) Current

Current mocks base method

func (*MockUnconsolidatedStepIter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUnconsolidatedStepIter) Err

Err mocks base method

func (*MockUnconsolidatedStepIter) Next

func (m *MockUnconsolidatedStepIter) Next() bool

Next mocks base method

func (*MockUnconsolidatedStepIter) SeriesMeta

func (m *MockUnconsolidatedStepIter) SeriesMeta() []SeriesMeta

SeriesMeta mocks base method

func (*MockUnconsolidatedStepIter) StepCount

func (m *MockUnconsolidatedStepIter) StepCount() int

StepCount mocks base method

type MockUnconsolidatedStepIterMockRecorder

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

MockUnconsolidatedStepIterMockRecorder is the mock recorder for MockUnconsolidatedStepIter

func (*MockUnconsolidatedStepIterMockRecorder) Close

Close indicates an expected call of Close

func (*MockUnconsolidatedStepIterMockRecorder) Current

Current indicates an expected call of Current

func (*MockUnconsolidatedStepIterMockRecorder) Err

Err indicates an expected call of Err

func (*MockUnconsolidatedStepIterMockRecorder) Next

Next indicates an expected call of Next

func (*MockUnconsolidatedStepIterMockRecorder) SeriesMeta

SeriesMeta indicates an expected call of SeriesMeta

func (*MockUnconsolidatedStepIterMockRecorder) StepCount

StepCount indicates an expected call of StepCount

type MockUnconsolidatedStepMockRecorder

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

MockUnconsolidatedStepMockRecorder is the mock recorder for MockUnconsolidatedStep

func (*MockUnconsolidatedStepMockRecorder) Time

Time indicates an expected call of Time

func (*MockUnconsolidatedStepMockRecorder) Values

Values indicates an expected call of Values

type Result

type Result struct {
	// Blocks is a list of blocks, optionally split across time boundaries.
	Blocks []Block
	// Metadata contains information on fetch status.
	Metadata ResultMetadata
	// Resolutions contains a slice representing resolution for graphite queries.
	Resolutions []int
}

Result is a fetch result containing multiple blocks optionally split across time boundaries.

type ResultMetadata

type ResultMetadata struct {
	// LocalOnly indicates that this query was executed only on the local store.
	LocalOnly bool
	// Exhaustive indicates whether the underlying data set presents a full
	// collection of retrieved data.
	Exhaustive bool
	// Warnings is a list of warnings that indicate potetitally partial or
	// incomplete results.
	Warnings Warnings
	// Resolutions is a list of resolutions for series obtained by this query.
	Resolutions []int64
	// ExemplarsList is a list of exemplars per datapoint per series obtained
	// by this query.
	ExemplarsList ts.SeriesExemplarList
}

ResultMetadata describes metadata common to each type of query results, indicating any additional information about the result.

func NewResultMetadata

func NewResultMetadata() ResultMetadata

NewResultMetadata creates a new result metadata.

func (*ResultMetadata) AddWarning

func (m *ResultMetadata) AddWarning(name string, message string)

AddWarning adds a warning to the result metadata. NB: warnings are expected to be small in general, so it's better to iterate over the array rather than introduce a map.

func (ResultMetadata) CombineMetadata

func (m ResultMetadata) CombineMetadata(other ResultMetadata) ResultMetadata

CombineMetadata combines two result metadatas.

func (ResultMetadata) IsDefault

func (m ResultMetadata) IsDefault() bool

IsDefault returns true if this result metadata matches the unchanged default.

type Scalar

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

Scalar is a block containing a single value over a certain bound This represents constant values; it greatly simplifies downstream operations by allowing them to treat this as a regular block, while at the same time having an option to optimize by accessing the scalar value directly instead.

func (*Scalar) Close

func (b *Scalar) Close() error

func (*Scalar) Info

func (c *Scalar) Info() BlockInfo

func (*Scalar) Meta

func (b *Scalar) Meta() Metadata

func (*Scalar) SeriesIter

func (b *Scalar) SeriesIter() (SeriesIter, error)

func (*Scalar) StepIter

func (b *Scalar) StepIter() (StepIter, error)

func (*Scalar) Unconsolidated

func (b *Scalar) Unconsolidated() (UnconsolidatedBlock, error)

Unconsolidated returns the unconsolidated version for the block.

func (*Scalar) Value

func (b *Scalar) Value() float64

type Series

type Series struct {
	Meta SeriesMeta
	// contains filtered or unexported fields
}

Series is a single series within a block

func NewSeries

func NewSeries(values []float64, meta SeriesMeta) Series

NewSeries creates a new series

func (Series) Len

func (s Series) Len() int

Len returns the number of datapoints in the series

func (Series) ValueAtStep

func (s Series) ValueAtStep(idx int) float64

ValueAtStep returns the datapoint value at a step index

func (Series) Values

func (s Series) Values() []float64

Values returns the internal values slice

type SeriesIter

type SeriesIter interface {
	Iterator
	SeriesMetaIter
	// Current returns the current series for the block.
	Current() Series
}

SeriesIter iterates through a block horizontally.

type SeriesMeta

type SeriesMeta struct {
	Tags models.Tags
	Name []byte
}

SeriesMeta is metadata data for the series.

func MustMakeSeriesMeta

func MustMakeSeriesMeta(tags ...string) SeriesMeta

MustMakeSeriesMeta returns series metadata or panics (unsafe for use).

type SeriesMetaIter

type SeriesMetaIter interface {
	// SeriesMeta returns the metadata for each series in the block.
	SeriesMeta() []SeriesMeta
	// SeriesCount returns the number of series.
	SeriesCount() int
}

SeriesMetaIter is implemented by series iterators which provide meta information.

type SeriesMetaTransform

type SeriesMetaTransform func(meta []SeriesMeta) []SeriesMeta

SeriesMetaTransform transforms series meta data.

type Step

type Step interface {
	Time() time.Time
	Values() []float64
}

Step is a single time step within a block.

func NewColStep

func NewColStep(t time.Time, values []float64) Step

NewColStep creates a new column step

type StepIter

type StepIter interface {
	Iterator
	StepMetaIter
	// Current returns the current step for the block.
	Current() Step
}

StepIter iterates through a block vertically.

type StepMetaIter

type StepMetaIter interface {
	// SeriesMeta returns the metadata for each series in the block.
	SeriesMeta() []SeriesMeta
	// StepCount returns the number of steps.
	StepCount() int
}

StepMetaIter is implemented by step iterators which provide meta information.

type TimeTransform

type TimeTransform func(time.Time) time.Time

TimeTransform transforms a timestamp.

type UnconsolidatedBlock

type UnconsolidatedBlock interface {
	io.Closer
	// StepIter returns a step-wise block iterator, giving unconsolidated values
	// across all series comprising the box at a single time step.
	StepIter() (UnconsolidatedStepIter, error)
	// SeriesIter returns a series-wise block iterator, giving unconsolidated
	// by series.
	SeriesIter() (UnconsolidatedSeriesIter, error)
	// Consolidate attempts to consolidate the unconsolidated block.
	Consolidate() (Block, error)
	// Meta returns the metadata for the block.
	Meta() Metadata
}

UnconsolidatedBlock represents a group of unconsolidated series across a time bound

type UnconsolidatedSeries

type UnconsolidatedSeries struct {
	Meta SeriesMeta
	// contains filtered or unexported fields
}

UnconsolidatedSeries is the series with raw datapoints

func NewUnconsolidatedSeries

func NewUnconsolidatedSeries(datapoints []ts.Datapoints, meta SeriesMeta) UnconsolidatedSeries

NewUnconsolidatedSeries creates a new series with raw datapoints

func (UnconsolidatedSeries) Consolidated

func (s UnconsolidatedSeries) Consolidated(consolidationFunc ConsolidationFunc) Series

Consolidated consolidates the series

func (UnconsolidatedSeries) Datapoints

func (s UnconsolidatedSeries) Datapoints() []ts.Datapoints

Datapoints returns the internal datapoints slice

func (UnconsolidatedSeries) DatapointsAtStep

func (s UnconsolidatedSeries) DatapointsAtStep(idx int) ts.Datapoints

DatapointsAtStep returns the raw datapoints at a step index

func (UnconsolidatedSeries) Len

func (s UnconsolidatedSeries) Len() int

Len returns the number of datapoints slices in the series

type UnconsolidatedSeriesIter

type UnconsolidatedSeriesIter interface {
	Iterator
	SeriesMetaIter
	// Current returns the current series for the block.
	Current() UnconsolidatedSeries
}

UnconsolidatedSeriesIter iterates through a block horizontally.

type UnconsolidatedStep

type UnconsolidatedStep interface {
	Time() time.Time
	Values() []ts.Datapoints
}

UnconsolidatedStep is a single unconsolidated time step within a block.

type UnconsolidatedStepIter

type UnconsolidatedStepIter interface {
	Iterator
	StepMetaIter
	// Current returns the current step for the block.
	Current() UnconsolidatedStep
}

UnconsolidatedStepIter iterates through a block vertically.

type ValueTransform

type ValueTransform func(float64) float64

ValueTransform transform a float64.

type Warning

type Warning struct {
	// Name is the name of the store originating the warning.
	Name string
	// Message is the content of the warning message.
	Message string
}

Warning is a message that indicates potential partial or incomplete results.

func (Warning) Header

func (w Warning) Header() string

Header formats the warning into a format to send in a response header.

type Warnings

type Warnings []Warning

Warnings is a slice of warnings.

Jump to

Keyboard shortcuts

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