Plugins: Plugins loader pipeline (#71438)
* discovery * flesh out * add docs * remove unused func * bootstrap stage * fix docs * update docs * undo unnecessary changes * add end tag * update doc * fix linter * fix * tidy * update docs * add class to filter func * apply PR feedback * fix test
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/config"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/assetpath"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/finder"
|
||||
"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/registry"
|
||||
)
|
||||
|
||||
func ProvideDiscoveryStage(cfg *config.Cfg, pluginFinder finder.Finder, pluginRegistry registry.Service) *discovery.Discovery {
|
||||
return discovery.New(cfg, discovery.Opts{
|
||||
FindFunc: func(ctx context.Context, src plugins.PluginSource) ([]*plugins.FoundBundle, error) {
|
||||
return pluginFinder.Find(ctx, src)
|
||||
},
|
||||
FindFilterFuncs: []discovery.FindFilterFunc{
|
||||
func(ctx context.Context, _ plugins.Class, bundles []*plugins.FoundBundle) ([]*plugins.FoundBundle, error) {
|
||||
return discovery.NewDuplicatePluginFilterStep(pluginRegistry).Filter(ctx, bundles)
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func ProvideBootstrapStage(cfg *config.Cfg, signatureCalculator plugins.SignatureCalculator, assetPath *assetpath.Service) *bootstrap.Bootstrap {
|
||||
return bootstrap.New(cfg, bootstrap.Opts{
|
||||
ConstructFunc: bootstrap.DefaultConstructFunc(signatureCalculator, assetPath),
|
||||
DecorateFuncs: bootstrap.DefaultDecorateFuncs,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user