mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): moved alerting models back to alerting package, models is more for storage dtos
This commit is contained in:
24
pkg/tsdb/executor.go
Normal file
24
pkg/tsdb/executor.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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 {
|
||||
if fn, exists := registry[dsInfo.Type]; exists {
|
||||
return fn(dsInfo)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func RegisterExecutor(dsType string, fn GetExecutorFn) {
|
||||
registry[dsType] = fn
|
||||
}
|
||||
Reference in New Issue
Block a user