Plugins: Split plugin manager into smaller components (#54384)
* split out plugin manager * remove whitespace * fix tests * split up tests * updating naming conventions * simplify manager * tidy * add more fakes * testing time * add query verif to int test * renaming * add process tests * tidy up manager tests * add extra case to int test * add more coverage to store and process tests * remove comment * fix capatilization * init on provide * remove addfromsource from API
This commit is contained in:
+5
-31
@@ -2,7 +2,6 @@ package plugins
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
|
||||
@@ -24,6 +23,11 @@ type Manager interface {
|
||||
Remove(ctx context.Context, pluginID string) error
|
||||
}
|
||||
|
||||
type PluginSource struct {
|
||||
Class Class
|
||||
Paths []string
|
||||
}
|
||||
|
||||
type CompatOpts struct {
|
||||
GrafanaVersion string
|
||||
OS string
|
||||
@@ -70,33 +74,3 @@ type PluginLoaderAuthorizer interface {
|
||||
// CanLoadPlugin confirms if a plugin is authorized to load
|
||||
CanLoadPlugin(plugin *Plugin) bool
|
||||
}
|
||||
|
||||
// ListPluginDashboardFilesArgs list plugin dashboard files argument model.
|
||||
type ListPluginDashboardFilesArgs struct {
|
||||
PluginID string
|
||||
}
|
||||
|
||||
// GetPluginDashboardFilesArgs list plugin dashboard files result model.
|
||||
type ListPluginDashboardFilesResult struct {
|
||||
FileReferences []string
|
||||
}
|
||||
|
||||
// GetPluginDashboardFileContentsArgs get plugin dashboard file content argument model.
|
||||
type GetPluginDashboardFileContentsArgs struct {
|
||||
PluginID string
|
||||
FileReference string
|
||||
}
|
||||
|
||||
// GetPluginDashboardFileContentsResult get plugin dashboard file content result model.
|
||||
type GetPluginDashboardFileContentsResult struct {
|
||||
Content io.ReadCloser
|
||||
}
|
||||
|
||||
// DashboardFileStore is the interface for plugin dashboard file storage.
|
||||
type DashboardFileStore interface {
|
||||
// ListPluginDashboardFiles lists plugin dashboard files.
|
||||
ListPluginDashboardFiles(ctx context.Context, args *ListPluginDashboardFilesArgs) (*ListPluginDashboardFilesResult, error)
|
||||
|
||||
// GetPluginDashboardFileContents gets the referenced plugin dashboard file content.
|
||||
GetPluginDashboardFileContents(ctx context.Context, args *GetPluginDashboardFileContentsArgs) (*GetPluginDashboardFileContentsResult, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user