transform

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 13 Imported by: 26

Documentation

Overview

Package transform is a generated GoMock package.

Package transform is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessSimpleBlock added in v0.7.0

func ProcessSimpleBlock(
	node simpleOpNode,
	controller *Controller,
	queryCtx *models.QueryContext,
	ID parser.NodeID,
	b block.Block,
) error

ProcessSimpleBlock is a utility for OpNode instances which on receiving a block, process and propagate it immediately (as opposed to nodes which e.g. depend on multiple blocks). It adds instrumentation to the processing, and handles propagating the block downstream. OpNode's should call this as their implementation of the Process method:

func (n MyNode) Process(queryCtx *models.QueryContext, ID parser.NodeID, b block.Block) error {

return transform.ProcessSimpleBlock(n, n.controller, queryCtx, ID, b)

}

Types

type BlockCache

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

BlockCache is used to cache blocks

func NewBlockCache

func NewBlockCache() *BlockCache

NewBlockCache creates a new BlockCache

func (*BlockCache) Add

func (c *BlockCache) Add(key parser.NodeID, b block.Block) error

Add the block to the cache, errors out if block already exists

func (*BlockCache) Get

func (c *BlockCache) Get(key parser.NodeID) (block.Block, bool)

Get the block from the cache TODO: Evaluate only a single process getting a block at a time

func (*BlockCache) Remove

func (c *BlockCache) Remove(key parser.NodeID)

Remove the block from the cache

type BoundOp added in v0.4.1

type BoundOp interface {
	Bounds() BoundSpec
}

BoundOp is an operation that is able to yield boundary information.

type BoundSpec added in v0.4.1

type BoundSpec struct {
	// Range is the time range for the operation.
	Range time.Duration
	// Offset is the offset for the operation.
	Offset time.Duration
}

BoundSpec is the boundary specification for an operation.

type Controller

type Controller struct {
	ID parser.NodeID
	// contains filtered or unexported fields
}

Controller controls the caching and forwarding the request to downstream.

func (*Controller) AddTransform

func (t *Controller) AddTransform(node OpNode)

AddTransform adds a dependent transformation to the controller.

func (*Controller) BlockBuilder

func (t *Controller) BlockBuilder(
	queryCtx *models.QueryContext,
	blockMeta block.Metadata,
	seriesMeta []block.SeriesMeta) (block.Builder, error)

BlockBuilder returns a BlockBuilder instance with associated metadata

func (*Controller) HasMultipleOperations added in v0.5.0

func (t *Controller) HasMultipleOperations() bool

HasMultipleOperations returns true if there are multiple operations.

func (*Controller) Process

func (t *Controller) Process(queryCtx *models.QueryContext, block block.Block) error

Process performs processing on the underlying transforms

type MetaNode

type MetaNode interface {
	// Meta provides the block metadata for the block using the
	// input blocks' metadata as input.
	Meta(meta block.Metadata) block.Metadata
	// SeriesMeta provides the series metadata for the block using the
	// previous blocks' series metadata as input.
	SeriesMeta(metas []block.SeriesMeta) []block.SeriesMeta
}

MetaNode is implemented by function nodes which can alter metadata for a block.

type MockOpNode added in v0.7.0

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

MockOpNode is a mock of OpNode interface.

func NewMockOpNode added in v0.7.0

func NewMockOpNode(ctrl *gomock.Controller) *MockOpNode

NewMockOpNode creates a new mock instance.

func (*MockOpNode) EXPECT added in v0.7.0

func (m *MockOpNode) EXPECT() *MockOpNodeMockRecorder

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

func (*MockOpNode) Process added in v0.7.0

func (m *MockOpNode) Process(arg0 *models.QueryContext, arg1 parser.NodeID, arg2 block.Block) error

Process mocks base method.

type MockOpNodeMockRecorder added in v0.7.0

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

MockOpNodeMockRecorder is the mock recorder for MockOpNode.

func (*MockOpNodeMockRecorder) Process added in v0.7.0

func (mr *MockOpNodeMockRecorder) Process(arg0, arg1, arg2 interface{}) *gomock.Call

Process indicates an expected call of Process.

type MocksimpleOpNode added in v0.7.0

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

MocksimpleOpNode is a mock of simpleOpNode interface.

func NewMocksimpleOpNode added in v0.7.0

func NewMocksimpleOpNode(ctrl *gomock.Controller) *MocksimpleOpNode

NewMocksimpleOpNode creates a new mock instance.

func (*MocksimpleOpNode) EXPECT added in v0.7.0

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

func (*MocksimpleOpNode) Params added in v0.7.0

func (m *MocksimpleOpNode) Params() parser.Params

Params mocks base method.

func (*MocksimpleOpNode) ProcessBlock added in v0.7.0

func (m *MocksimpleOpNode) ProcessBlock(queryCtx *models.QueryContext, ID parser.NodeID, b block.Block) (block.Block, error)

ProcessBlock mocks base method.

type MocksimpleOpNodeMockRecorder added in v0.7.0

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

MocksimpleOpNodeMockRecorder is the mock recorder for MocksimpleOpNode.

func (*MocksimpleOpNodeMockRecorder) Params added in v0.7.0

Params indicates an expected call of Params.

func (*MocksimpleOpNodeMockRecorder) ProcessBlock added in v0.7.0

func (mr *MocksimpleOpNodeMockRecorder) ProcessBlock(queryCtx, ID, b interface{}) *gomock.Call

ProcessBlock indicates an expected call of ProcessBlock.

type OpNode

type OpNode interface {
	Process(
		queryCtx *models.QueryContext,
		ID parser.NodeID,
		block block.Block,
	) error
}

OpNode represents an execution node.

type Options

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

Options to create transform nodes.

func NewOptions added in v0.11.0

func NewOptions(p OptionsParams) (Options, error)

NewOptions enforces that fields are set when options is created.

func (Options) BlockType added in v0.5.0

func (o Options) BlockType() models.FetchedBlockType

BlockType returns the BlockType option.

func (Options) Debug

func (o Options) Debug() bool

Debug returns the Debug option.

func (Options) FetchOptions added in v0.11.0

func (o Options) FetchOptions() *storage.FetchOptions

FetchOptions returns the FetchOptions option.

func (Options) InstrumentOptions added in v0.11.0

func (o Options) InstrumentOptions() instrument.Options

InstrumentOptions returns the InstrumentOptions option.

func (Options) TimeSpec

func (o Options) TimeSpec() TimeSpec

TimeSpec returns the TimeSpec option.

type OptionsParams added in v0.11.0

type OptionsParams struct {
	FetchOptions      *storage.FetchOptions
	TimeSpec          TimeSpec
	Debug             bool
	BlockType         models.FetchedBlockType
	InstrumentOptions instrument.Options
}

OptionsParams are the parameters used to create Options.

type Params

type Params interface {
	parser.Params
	Node(controller *Controller, opts Options) OpNode
}

Params are defined by transforms.

type TimeSpec

type TimeSpec struct {
	// Start is the inclusive start bound for the query.
	Start xtime.UnixNano
	// End is the exclusive end bound for the query.
	End xtime.UnixNano
	// Now captures the current time and fixes it throughout the request.
	Now time.Time
	// Step is the step size for the query.
	Step time.Duration
}

TimeSpec defines the time bounds for the query execution. Start is inclusive and End is exclusive.

func (TimeSpec) Bounds added in v0.4.1

func (ts TimeSpec) Bounds() models.Bounds

Bounds transforms the timespec to bounds.

Jump to

Keyboard shortcuts

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