plan

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

Documentation

Index

Constants

View Source
const DefaultYieldName = "_result"

DefaultYieldName is the yield name to use in cases where no explicit yield name was specified.

Variables

View Source
var NilUUID uuid.UUID
View Source
var RootUUID = NilUUID

Functions

func Formatted

func Formatted(p PlanReader, opts ...FormatOption) fmt.Formatter

func RegisterProcedureSpec

func RegisterProcedureSpec(k ProcedureKind, c CreateProcedureSpec, qks ...query.OperationKind)

RegisterProcedureSpec registers a new procedure with the specified kind. The call panics if the kind is not unique.

func RegisterRewriteRule added in v0.0.5

func RegisterRewriteRule(r RewriteRule)

Types

type Administration added in v0.0.4

type Administration interface {
	ConvertID(query.OperationID) ProcedureID
}

type AggregateProcedureSpec added in v0.0.5

type AggregateProcedureSpec interface {
	// AggregateMethod specifies which aggregate method to push down to the storage layer.
	AggregateMethod() string
	// ReAggregateSpec specifies an aggregate procedure to use when aggregating the individual pushed down results.
	ReAggregateSpec() ProcedureSpec
}

type BoundedProcedureSpec

type BoundedProcedureSpec interface {
	TimeBounds() BoundsSpec
}

type BoundsSpec

type BoundsSpec struct {
	Start query.Time
	Stop  query.Time
}

func (BoundsSpec) Union

func (b BoundsSpec) Union(o BoundsSpec, now time.Time) (u BoundsSpec)

type CreateProcedureSpec

type CreateProcedureSpec func(query.OperationSpec, Administration) (ProcedureSpec, error)

type FormatOption

type FormatOption func(*formatter)

TODO(nathanielc): Add better options for formatting plans as Graphviz dot format.

func UseIDs

func UseIDs() FormatOption

type LogicalPlanSpec

type LogicalPlanSpec struct {
	Procedures map[ProcedureID]*Procedure
	Order      []ProcedureID
	Resources  query.ResourceManagement
}

func (*LogicalPlanSpec) Do

func (lp *LogicalPlanSpec) Do(f func(pr *Procedure))

type LogicalPlanner

type LogicalPlanner interface {
	Plan(*query.Spec) (*LogicalPlanSpec, error)
}

func NewLogicalPlanner

func NewLogicalPlanner() LogicalPlanner

type ParentAwareProcedureSpec added in v0.0.4

type ParentAwareProcedureSpec interface {
	ParentChanged(old, new ProcedureID)
}

type PlanReader

type PlanReader interface {
	Do(func(*Procedure))
	// contains filtered or unexported methods
}

type PlanRewriter added in v0.0.5

type PlanRewriter interface {
	IsolatePath(parent, child *Procedure) (*Procedure, error)
	RemoveBranch(pr *Procedure) error
	AddChild(parent *Procedure, childSpec ProcedureSpec)
}

type PlanSpec

type PlanSpec struct {
	// Now represents the relative currentl time of the plan.
	Now    time.Time
	Bounds BoundsSpec
	// Procedures is a set of all operations
	Procedures map[ProcedureID]*Procedure
	Order      []ProcedureID
	// Results is a list of datasets that are the result of the plan
	Results map[string]YieldSpec

	Resources query.ResourceManagement
}

func (*PlanSpec) Do

func (p *PlanSpec) Do(f func(pr *Procedure))

type Planner

type Planner interface {
	// Plan create a plan from the logical plan and available storage.
	Plan(p *LogicalPlanSpec, s Storage, now time.Time) (*PlanSpec, error)
}

func NewPlanner

func NewPlanner() Planner

type Procedure

type Procedure struct {
	ID       ProcedureID
	Parents  []ProcedureID
	Children []ProcedureID
	Spec     ProcedureSpec
	// contains filtered or unexported fields
}

func (*Procedure) Child added in v0.0.5

func (p *Procedure) Child(i int) *Procedure

func (*Procedure) Copy

func (p *Procedure) Copy() *Procedure

func (*Procedure) DoChildren added in v0.0.5

func (p *Procedure) DoChildren(f func(pr *Procedure))

func (*Procedure) DoParents added in v0.0.5

func (p *Procedure) DoParents(f func(pr *Procedure))

type ProcedureID

type ProcedureID uuid.UUID
var ZeroProcedureID ProcedureID

func ProcedureIDForDuplicate

func ProcedureIDForDuplicate(id ProcedureID) ProcedureID

func ProcedureIDFromOperationID

func ProcedureIDFromOperationID(id query.OperationID) ProcedureID

func ProcedureIDFromParentID added in v0.0.5

func ProcedureIDFromParentID(id ProcedureID) ProcedureID

func (ProcedureID) String

func (id ProcedureID) String() string

type ProcedureKind

type ProcedureKind string

ProcedureKind denotes the kind of operations.

type ProcedureSpec

type ProcedureSpec interface {
	// Kind returns the kind of the procedure.
	Kind() ProcedureKind
	Copy() ProcedureSpec
}

ProcedureSpec specifies an operation as part of a query.

type PushDownProcedureSpec

type PushDownProcedureSpec interface {
	PushDownRules() []PushDownRule
	PushDown(root *Procedure, dup func() *Procedure)
}

type PushDownRule

type PushDownRule struct {
	Root    ProcedureKind
	Through []ProcedureKind
	Match   func(ProcedureSpec) bool
}

TODO(nathanielc): make this more formal using commute/associative properties

type RewriteRule added in v0.0.5

type RewriteRule interface {
	Root() ProcedureKind
	Rewrite(*Procedure, PlanRewriter) error
}

type Shard

type Shard struct {
	Node  string
	Range TimeRange
}

type ShardMap

type ShardMap map[string][]Shard

ShardMap is a mapping of database names to list of shards for that database.

type Storage

type Storage interface {
	ShardMapping() ShardMap
}

type TimeRange

type TimeRange struct {
	Start time.Time
	Stop  time.Time
}

type WindowSpec

type WindowSpec struct {
	Every  query.Duration
	Period query.Duration
	Round  query.Duration
	Start  query.Time
}

type YieldProcedureSpec added in v0.0.5

type YieldProcedureSpec interface {
	YieldName() string
}

type YieldSpec added in v0.0.5

type YieldSpec struct {
	ID ProcedureID
}

YieldSpec defines how data should be yielded.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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