2016-06-06 03:31:21 -05:00
|
|
|
package tsdb
|
|
|
|
|
|
|
|
type Executor interface {
|
|
|
|
Execute(queries QuerySlice, context *QueryContext) *BatchResult
|
|
|
|
}
|
|
|
|
|
|
|
|
var registry map[string]GetExecutorFn
|
|
|
|
|
|
|
|
type GetExecutorFn func(dsInfo *DataSourceInfo) Executor
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
registry = make(map[string]GetExecutorFn)
|
|
|
|
}
|
|
|
|
|
|
|
|
func getExecutorFor(dsInfo *DataSourceInfo) Executor {
|
2016-06-06 10:11:46 -05:00
|
|
|
if fn, exists := registry[dsInfo.PluginId]; exists {
|
2016-06-06 03:31:21 -05:00
|
|
|
return fn(dsInfo)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-06-06 10:11:46 -05:00
|
|
|
func RegisterExecutor(pluginId string, fn GetExecutorFn) {
|
|
|
|
registry[pluginId] = fn
|
2016-06-06 03:31:21 -05:00
|
|
|
}
|