mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 08:52:38 +08:00
Plugins: Refactor loader + finder to support multiple sourcing methods (#64735)
* it's cdn time * tidy body closing * auto signed * fix close * update log name * remove comments
This commit is contained in:
38
pkg/plugins/manager/sources/source_local_disk.go
Normal file
38
pkg/plugins/manager/sources/source_local_disk.go
Normal file
@ -0,0 +1,38 @@
|
||||
package sources
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
)
|
||||
|
||||
type LocalSource struct {
|
||||
paths []string
|
||||
class plugins.Class
|
||||
}
|
||||
|
||||
func NewLocalSource(class plugins.Class, paths []string) *LocalSource {
|
||||
return &LocalSource{
|
||||
class: class,
|
||||
paths: paths,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LocalSource) PluginClass(_ context.Context) plugins.Class {
|
||||
return s.class
|
||||
}
|
||||
|
||||
func (s *LocalSource) PluginURIs(_ context.Context) []string {
|
||||
return s.paths
|
||||
}
|
||||
|
||||
func (s *LocalSource) DefaultSignature(_ context.Context) (plugins.Signature, bool) {
|
||||
switch s.class {
|
||||
case plugins.Core:
|
||||
return plugins.Signature{
|
||||
Status: plugins.SignatureInternal,
|
||||
}, true
|
||||
default:
|
||||
return plugins.Signature{}, false
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user