Plugins: Introduce Plugin Registry (#47200)

* introduce registry write/read separation

* internal + external registries

* fix tests

* fixup

* rename

* move interfaces

* back to plugins.Store

* fix registry name

* remove context.TODOs

* remove some ctx for now

* tidy

* remove dupe logic

* update naming

* move from manager.go to store

* amend logger name

* new store writer svc

* restrict changes

* more simplifying

* move interfaces around

* remove unused

* fix linter

* tidy

* add registry test

* fix tests

* revert testdata changes

* revert testdata changes #1

* revert testdata changes #2

* revert testdata changes #3

* revert testdata changes #4

* revert testdata changes #5

* revert testdata changes

* fixup testdata

* remove unused log

* update naming in test

* adjust ctx in test
This commit is contained in:
Will Browne
2022-06-03 13:06:27 +02:00
committed by GitHub
parent 6c7b6a7c34
commit 7536647ab6
15 changed files with 547 additions and 158 deletions
+19
View File
@@ -0,0 +1,19 @@
package registry
import (
"context"
"github.com/grafana/grafana/pkg/plugins"
)
// Service is responsible for the storing and retrieval of plugins.
type Service interface {
// Plugin finds a plugin by its ID.
Plugin(ctx context.Context, id string) (*plugins.Plugin, bool)
// Plugins returns all plugins.
Plugins(ctx context.Context) []*plugins.Plugin
// Add adds the provided plugin to the registry.
Add(ctx context.Context, plugin *plugins.Plugin) error
// Remove deletes the requested plugin from the registry.
Remove(ctx context.Context, id string) error
}