control

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: AGPL-3.0, AGPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string) (*span, context.Context)

Types

type Config

type Config struct {
	ConcurrencyQuota int
	MemoryBytesQuota int64
	ExecutorConfig   execute.Config
	Verbose          bool
}

type Controller

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

Controller provides a central location to manage all incoming queries. The controller is responsible for queueing, planning, and executing queries.

func New

func New(c Config) *Controller

func (*Controller) Queries

func (c *Controller) Queries() []*Query

Queries reports the active queries.

func (*Controller) Query

func (c *Controller) Query(ctx context.Context, qSpec *query.Spec) (*Query, error)

Query submits a query for execution returning immediately. The spec must not be modified while the query is still active. Done must be called on any returned Query objects.

func (*Controller) QueryWithCompile added in v0.0.4

func (c *Controller) QueryWithCompile(ctx context.Context, queryStr string) (*Query, error)

QueryWithCompile submits a query for execution returning immediately. The query will first be compiled before submitting for execution. Done must be called on any returned Query objects.

type PriorityQueue

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

func (*PriorityQueue) Peek

func (p *PriorityQueue) Peek() *Query

func (*PriorityQueue) Pop

func (p *PriorityQueue) Pop() *Query

func (*PriorityQueue) Push

func (p *PriorityQueue) Push(q *Query)

type Query

type Query struct {
	Spec query.Spec

	// Ready is a channel that will deliver the query results.
	// The channel may be closed before any results arrive, in which case the query should be
	// inspected for an error using Err().
	Ready <-chan map[string]execute.Result
	// contains filtered or unexported fields
}

Query represents a single request.

func (*Query) Cancel

func (q *Query) Cancel()

Cancel will stop the query execution. Done must still be called to free resources.

func (*Query) Done

func (q *Query) Done()

Done must always be called to free resources.

func (*Query) Err

func (q *Query) Err() error

Err reports any error the query may have encountered.

func (*Query) ID

func (q *Query) ID() QueryID

ID reports an ephemeral unique ID for the query.

func (*Query) State

func (q *Query) State() State

State reports the current state of the query.

type QueryID

type QueryID uint64

type State

type State int

State is the query state.

const (
	Created State = iota
	Compiling
	Queueing
	Planning
	Requeueing
	Executing
	Errored
	Finished
	Canceled
)

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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