feat(alerting): moved alerting models back to alerting package, models is more for storage dtos

This commit is contained in:
Torkel Ödegaard
2016-06-06 10:31:21 +02:00
parent 70cb8400c3
commit a191b9b1cf
19 changed files with 578 additions and 313 deletions

24
pkg/tsdb/executor.go Normal file
View 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
}