mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
da4832724e
Delete stub for SQL backend
38 lines
858 B
Go
38 lines
858 B
Go
package historian
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// BackendType identifies different kinds of state history backends.
|
|
type BackendType string
|
|
|
|
// String implements Stringer for BackendType.
|
|
func (bt BackendType) String() string {
|
|
return string(bt)
|
|
}
|
|
|
|
const (
|
|
BackendTypeAnnotations BackendType = "annotations"
|
|
BackendTypeLoki BackendType = "loki"
|
|
BackendTypeMultiple BackendType = "multiple"
|
|
BackendTypeNoop BackendType = "noop"
|
|
)
|
|
|
|
func ParseBackendType(s string) (BackendType, error) {
|
|
norm := strings.ToLower(strings.TrimSpace(s))
|
|
|
|
types := map[BackendType]struct{}{
|
|
BackendTypeAnnotations: {},
|
|
BackendTypeLoki: {},
|
|
BackendTypeMultiple: {},
|
|
BackendTypeNoop: {},
|
|
}
|
|
p := BackendType(norm)
|
|
if _, ok := types[p]; !ok {
|
|
return "", fmt.Errorf("unrecognized state history backend: %s", p)
|
|
}
|
|
return p, nil
|
|
}
|