Plugins: Move discovery logic to plugin sources (#106911)
* move finder behaviour to source * tidy * undo go.mod changes * fix comment * tidy unsafe local source
This commit is contained in:
@@ -480,7 +480,7 @@ func (s *FakeSourceRegistry) List(ctx context.Context) []plugins.PluginSource {
|
||||
|
||||
type FakePluginSource struct {
|
||||
PluginClassFunc func(ctx context.Context) plugins.Class
|
||||
PluginURIsFunc func(ctx context.Context) []string
|
||||
DiscoverFunc func(ctx context.Context) ([]*plugins.FoundBundle, error)
|
||||
DefaultSignatureFunc func(ctx context.Context) (plugins.Signature, bool)
|
||||
}
|
||||
|
||||
@@ -491,11 +491,11 @@ func (s *FakePluginSource) PluginClass(ctx context.Context) plugins.Class {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (s *FakePluginSource) PluginURIs(ctx context.Context) []string {
|
||||
if s.PluginURIsFunc != nil {
|
||||
return s.PluginURIsFunc(ctx)
|
||||
func (s *FakePluginSource) Discover(ctx context.Context) ([]*plugins.FoundBundle, error) {
|
||||
if s.DiscoverFunc != nil {
|
||||
return s.DiscoverFunc(ctx)
|
||||
}
|
||||
return []string{}
|
||||
return []*plugins.FoundBundle{}, nil
|
||||
}
|
||||
|
||||
func (s *FakePluginSource) DefaultSignature(ctx context.Context, _ string) (plugins.Signature, bool) {
|
||||
|
||||
Reference in New Issue
Block a user