Plugins: Make it possible to support multiple plugin versions (#82116)

* first pass

* use version in more places

* add comment

* update installer

* fix wire

* fix tests

* tidy

* simplify changes

* fix in mem

* remove unused step

* fix step dupe logic for child plugins + add tests
This commit is contained in:
Will Browne
2024-02-12 12:47:49 +01:00
committed by GitHub
parent 730e1d2485
commit 788b9afda3
24 changed files with 292 additions and 131 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ import (
"github.com/grafana/grafana/pkg/plugins"
)
// InMemory is a registry that only allows a single version of a plugin to be registered at a time.
type InMemory struct {
store map[string]*plugins.Plugin
alias map[string]*plugins.Plugin
@@ -25,7 +26,7 @@ func NewInMemory() *InMemory {
}
}
func (i *InMemory) Plugin(_ context.Context, pluginID string) (*plugins.Plugin, bool) {
func (i *InMemory) Plugin(_ context.Context, pluginID, _ string) (*plugins.Plugin, bool) {
return i.plugin(pluginID)
}
@@ -56,7 +57,7 @@ func (i *InMemory) Add(_ context.Context, p *plugins.Plugin) error {
return nil
}
func (i *InMemory) Remove(_ context.Context, pluginID string) error {
func (i *InMemory) Remove(_ context.Context, pluginID, _ string) error {
p, ok := i.plugin(pluginID)
if !ok {
return fmt.Errorf("plugin %s is not registered", pluginID)