mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 23:53:25 -06:00
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package loader
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/plugins"
|
|
pluginsLoader "github.com/grafana/grafana/pkg/plugins/manager/loader"
|
|
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/bootstrap"
|
|
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/discovery"
|
|
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/initialization"
|
|
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/termination"
|
|
"github.com/grafana/grafana/pkg/plugins/manager/pipeline/validation"
|
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
|
|
)
|
|
|
|
var _ pluginsLoader.Service = (*Loader)(nil)
|
|
|
|
type Loader struct {
|
|
loader *pluginsLoader.Loader
|
|
}
|
|
|
|
func ProvideService(discovery discovery.Discoverer, bootstrap bootstrap.Bootstrapper, validation validation.Validator,
|
|
initializer initialization.Initializer, termination termination.Terminator, errorTracker pluginerrs.ErrorTracker,
|
|
) *Loader {
|
|
return &Loader{
|
|
loader: pluginsLoader.New(discovery, bootstrap, validation, initializer, termination, errorTracker),
|
|
}
|
|
}
|
|
|
|
func (l *Loader) Load(ctx context.Context, src plugins.PluginSource) ([]*plugins.Plugin, error) {
|
|
return l.loader.Load(ctx, src)
|
|
}
|
|
|
|
func (l *Loader) Unload(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {
|
|
return l.loader.Unload(ctx, p)
|
|
}
|