transform

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 6 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLazyNode

func NewLazyNode(node OpNode, controller *Controller) (OpNode, *Controller)

NewLazyNode creates a new wrapper around a function fNode to make it support lazy initialization

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 implements by operations which have bounds

type BoundSpec added in v0.4.1

type BoundSpec struct {
	Range  time.Duration
	Offset time.Duration
}

BoundSpec is the bound spec 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(blockMeta block.Metadata, seriesMeta []block.SeriesMeta) (block.Builder, error)

BlockBuilder returns a BlockBuilder instance with associated metadata

func (*Controller) Process

func (t *Controller) Process(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 OpNode

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

OpNode represents the execution node

type Options

type Options struct {
	TimeSpec TimeSpec
	Debug    bool
}

Options to create transform nodes

type Params

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

Params are defined by transforms

type SeriesNode

type SeriesNode interface {
	MetaNode
	ProcessSeries(series block.Series) (block.Series, error)
}

SeriesNode is implemented by function nodes which can support series iteration

type StepNode

type StepNode interface {
	MetaNode
	ProcessStep(step block.Step) (block.Step, error)
}

StepNode is implemented by function nodes which can support step iteration

type TimeSpec

type TimeSpec struct {
	Start time.Time
	End   time.Time
	// Now captures the current time and fixes it throughout the request, we may let people override it in the future
	Now  time.Time
	Step time.Duration
}

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

func (TimeSpec) Bounds added in v0.4.1

func (ts TimeSpec) Bounds() models.Bounds

Bounds transforms a timespec to bounds

Jump to

Keyboard shortcuts

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