29 lines
588 B
Go
29 lines
588 B
Go
package execute
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/influxdata/platform/query/plan"
|
|
)
|
|
|
|
type Node interface {
|
|
AddTransformation(t Transformation)
|
|
}
|
|
|
|
type Source interface {
|
|
Node
|
|
Run(ctx context.Context)
|
|
}
|
|
|
|
type CreateSource func(spec plan.ProcedureSpec, id DatasetID, ctx Administration) (Source, error)
|
|
|
|
var procedureToSource = make(map[plan.ProcedureKind]CreateSource)
|
|
|
|
func RegisterSource(k plan.ProcedureKind, c CreateSource) {
|
|
if procedureToSource[k] != nil {
|
|
panic(fmt.Errorf("duplicate registration for source with procedure kind %v", k))
|
|
}
|
|
procedureToSource[k] = c
|
|
}
|