mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Add plugin version field to proto interface (#78213)
add plugin version
This commit is contained in:
parent
0122f7ccad
commit
b3ad61e180
@ -26,19 +26,22 @@ type ProtoClient interface {
|
|||||||
|
|
||||||
PID() (string, error)
|
PID() (string, error)
|
||||||
PluginID() string
|
PluginID() string
|
||||||
|
PluginVersion() string
|
||||||
Logger() log.Logger
|
Logger() log.Logger
|
||||||
Start(context.Context) error
|
Start(context.Context) error
|
||||||
Stop(context.Context) error
|
Stop(context.Context) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type protoClient struct {
|
type protoClient struct {
|
||||||
plugin *grpcPlugin
|
plugin *grpcPlugin
|
||||||
|
pluginVersion string
|
||||||
|
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProtoClientOpts struct {
|
type ProtoClientOpts struct {
|
||||||
PluginID string
|
PluginID string
|
||||||
|
PluginVersion string
|
||||||
ExecutablePath string
|
ExecutablePath string
|
||||||
ExecutableArgs []string
|
ExecutableArgs []string
|
||||||
Env []string
|
Env []string
|
||||||
@ -58,7 +61,7 @@ func NewProtoClient(opts ProtoClientOpts) (ProtoClient, error) {
|
|||||||
func() []string { return opts.Env },
|
func() []string { return opts.Env },
|
||||||
)
|
)
|
||||||
|
|
||||||
return &protoClient{plugin: p}, nil
|
return &protoClient{plugin: p, pluginVersion: opts.PluginVersion}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *protoClient) PID() (string, error) {
|
func (r *protoClient) PID() (string, error) {
|
||||||
@ -72,6 +75,10 @@ func (r *protoClient) PluginID() string {
|
|||||||
return r.plugin.descriptor.pluginID
|
return r.plugin.descriptor.pluginID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *protoClient) PluginVersion() string {
|
||||||
|
return r.pluginVersion
|
||||||
|
}
|
||||||
|
|
||||||
func (r *protoClient) Logger() log.Logger {
|
func (r *protoClient) Logger() log.Logger {
|
||||||
return r.plugin.logger
|
return r.plugin.logger
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user