[WIP] Plugins: Refactoring backend initialization flow (#42247)
* refactoring store interface and init flow * fix import * fix linter * refactor resource calling * load with class * re-order args * fix tests * fix linter * remove old creator * add custom config struct * fix some tests * cleanup * fix linter * add connect failure error * remove unused err * convert test over
This commit is contained in:
@@ -34,10 +34,10 @@ type AddOpts struct {
|
||||
// Loader is responsible for loading plugins from the file system.
|
||||
type Loader interface {
|
||||
// Load will return a list of plugins found in the provided file system paths.
|
||||
Load(paths []string, ignore map[string]struct{}) ([]*Plugin, error)
|
||||
Load(ctx context.Context, class Class, paths []string, ignore map[string]struct{}) ([]*Plugin, error)
|
||||
// LoadWithFactory will return a plugin found in the provided file system path and use the provided factory to
|
||||
// construct the plugin backend client.
|
||||
LoadWithFactory(path string, factory backendplugin.PluginFactoryFunc) (*Plugin, error)
|
||||
LoadWithFactory(ctx context.Context, class Class, path string, factory backendplugin.PluginFactoryFunc) (*Plugin, error)
|
||||
}
|
||||
|
||||
// Installer is responsible for managing plugins (add / remove) on the file system.
|
||||
@@ -65,6 +65,11 @@ type Client interface {
|
||||
CollectMetrics(ctx context.Context, pluginID string) (*backend.CollectMetricsResult, error)
|
||||
}
|
||||
|
||||
// BackendFactoryProvider provides a backend factory for a provided plugin.
|
||||
type BackendFactoryProvider interface {
|
||||
BackendFactory(ctx context.Context, p *Plugin) backendplugin.PluginFactoryFunc
|
||||
}
|
||||
|
||||
type RendererManager interface {
|
||||
// Renderer returns a renderer plugin.
|
||||
Renderer() *Plugin
|
||||
|
||||
Reference in New Issue
Block a user