mirror of
https://github.com/grafana/grafana.git
synced 2026-08-03 10:03:15 -05:00
Fix circular imports
This commit is contained in:
+1
-12
@@ -6,8 +6,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
||||
)
|
||||
|
||||
// Store is the publicly accessible storage for plugins.
|
||||
@@ -182,14 +182,3 @@ type KeyStore interface {
|
||||
type KeyRetriever interface {
|
||||
GetPublicKey(ctx context.Context, keyID string) (string, error)
|
||||
}
|
||||
|
||||
type AngularPatternsStore interface {
|
||||
// TODO: move GCOMPatterns into another package
|
||||
Get(ctx context.Context) (angulardetectorsprovider.GCOMPatterns, error)
|
||||
Set(ctx context.Context, patterns angulardetectorsprovider.GCOMPatterns) error
|
||||
GetLastUpdated(ctx context.Context) (time.Time, error)
|
||||
}
|
||||
|
||||
/*type AngularDetectorsProvider interface {
|
||||
ProvideDetectors(ctx context.Context) []angulardetector.Detector
|
||||
}*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/kvstore"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -24,7 +25,7 @@ func ProvideService(kv kvstore.KVStore) *Service {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) Get(ctx context.Context) ([]map[string]string, error) {
|
||||
func (s *Service) Get(ctx context.Context) (angulardetectorsprovider.GCOMPatterns, error) {
|
||||
data, ok, err := s.kv.Get(ctx, keyPatterns)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("kv get: %w", err)
|
||||
@@ -32,7 +33,7 @@ func (s *Service) Get(ctx context.Context) ([]map[string]string, error) {
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
var out map[string]string
|
||||
var out angulardetectorsprovider.GCOMPatterns
|
||||
if err := json.Unmarshal([]byte(data), &out); err != nil {
|
||||
// Ignore decode errors, so we can change the format in future versions
|
||||
// and keep backwards/forwards compatibility
|
||||
@@ -42,7 +43,7 @@ func (s *Service) Get(ctx context.Context) ([]map[string]string, error) {
|
||||
|
||||
}
|
||||
|
||||
func (s *Service) Set(ctx context.Context, patterns []map[string]string) error {
|
||||
func (s *Service) Set(ctx context.Context, patterns angulardetectorsprovider.GCOMPatterns) error {
|
||||
b, err := json.Marshal(patterns)
|
||||
if err != nil {
|
||||
return fmt.Errorf("json marshal: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user