executor

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: Apache-2.0 Imports: 17 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateScalarSource added in v0.4.1

func CreateScalarSource(
	ID parser.NodeID,
	params ScalarParams,
	options transform.Options,
) (parser.Source, *transform.Controller)

CreateScalarSource creates a scalar source node

func CreateSource

func CreateSource(
	ID parser.NodeID,
	params SourceParams, storage storage.Storage,
	options transform.Options,
) (parser.Source, *transform.Controller)

CreateSource creates a source node

func CreateTransform

func CreateTransform(
	ID parser.NodeID,
	params transform.Params,
	options transform.Options,
) (transform.OpNode, *transform.Controller)

CreateTransform creates a transform node which works on functions and contains state

Types

type Engine

type Engine interface {
	// Execute runs the query and closes the results channel once done.
	Execute(
		ctx context.Context,
		query *storage.FetchQuery,
		opts *QueryOptions,
		results chan *storage.QueryResult,
	)

	// ExecuteExpr runs the query DAG and closes the results channel once done.
	ExecuteExpr(
		ctx context.Context,
		parser parser.Parser,
		opts *QueryOptions,
		params models.RequestParams,
		results chan Query,
	)

	// Close kills all running queries and prevents new queries from being attached.
	Close() error
}

Engine executes a Query.

func NewEngine

func NewEngine(
	engineOpts EngineOptions,
) Engine

NewEngine returns a new instance of QueryExecutor.

type EngineOptions

type EngineOptions interface {
	// CostScopte returns the scope used for metrics.
	CostScope() tally.Scope
	// SetCostScope sets the scope used for metrics.
	SetCostScope(tally.Scope) EngineOptions

	// GlobalEnforcer returns the query cost enforcer.
	GlobalEnforcer() qcost.ChainedEnforcer
	// SetGlobalEnforcer sets the query cost enforcer.
	SetGlobalEnforcer(qcost.ChainedEnforcer) EngineOptions

	// Store returns the storage.
	Store() storage.Storage
	// SetStore sets the storage.
	SetStore(storage.Storage) EngineOptions

	// LookbackDuration returns the query lookback duration.
	LookbackDuration() time.Duration
	// SetLookbackDuration sets the query lookback duration.
	SetLookbackDuration(time.Duration) EngineOptions
}

EngineOptions are used to create an engine.

func NewEngineOpts added in v0.10.0

func NewEngineOpts() EngineOptions

NewEngineOpts returns a new instance of options used to create an engine.

type ExecutionState

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

ExecutionState represents the execution hierarchy

func GenerateExecutionState

func GenerateExecutionState(
	pplan plan.PhysicalPlan,
	storage storage.Storage,
) (*ExecutionState, error)

GenerateExecutionState creates an execution state from the physical plan

func (*ExecutionState) Execute

func (s *ExecutionState) Execute(queryCtx *models.QueryContext) error

Execute the sources in parallel and return the first error

func (*ExecutionState) String

func (s *ExecutionState) String() string

String representation of the state

type Query

type Query struct {
	Err    error
	Result Result
}

Query is the result after execution.

type QueryOptions added in v0.10.0

type QueryOptions struct {
	QueryContextOptions models.QueryContextOptions
}

QueryOptions can be used to pass custom flags to engine.

type Request added in v0.4.8

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

Request represents a single request.

type Result

type Result interface {
	ResultChan() chan ResultChan
	// contains filtered or unexported methods
}

Result provides the execution results

type ResultChan

type ResultChan struct {
	Block block.Block
	Err   error
}

ResultChan has the result from a block

type ResultNode

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

ResultNode is used to provide the results to the caller from the query execution

func (*ResultNode) Process

func (r *ResultNode) Process(queryCtx *models.QueryContext, ID parser.NodeID, block block.Block) error

Process the block

func (*ResultNode) ResultChan

func (r *ResultNode) ResultChan() chan ResultChan

ResultChan return a channel to stream back resultChan to the client

type ScalarParams added in v0.4.1

type ScalarParams interface {
	parser.Params
	Node(
		controller *transform.Controller,
		options transform.Options,
	) parser.Source
}

ScalarParams are defined by sources

type SourceParams

type SourceParams interface {
	parser.Params
	Node(
		controller *transform.Controller,
		storage storage.Storage,
		options transform.Options,
	) parser.Source
}

SourceParams are defined by sources

type State added in v0.4.8

type State int

State is the request state.

func (State) String added in v0.4.8

func (s State) String() string

Directories

Path Synopsis
Package transform is a generated GoMock package.
Package transform is a generated GoMock package.

Jump to

Keyboard shortcuts

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