mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 12:52:15 +08:00
Plugins: Add API for creating pluginv2 proto client (#77492)
* first pass * remove client from plugin * fix wire * update * undo import change * add opts * add check * tidy * re-use logic * rollback changes
This commit is contained in:
@ -26,7 +26,7 @@ type grpcPlugin struct {
|
||||
descriptor PluginDescriptor
|
||||
clientFactory func() *plugin.Client
|
||||
client *plugin.Client
|
||||
pluginClient pluginClient
|
||||
pluginClient *ClientV2
|
||||
logger log.Logger
|
||||
mutex sync.RWMutex
|
||||
decommissioned bool
|
||||
@ -35,13 +35,17 @@ type grpcPlugin struct {
|
||||
// newPlugin allocates and returns a new gRPC (external) backendplugin.Plugin.
|
||||
func newPlugin(descriptor PluginDescriptor) backendplugin.PluginFactoryFunc {
|
||||
return func(pluginID string, logger log.Logger, env func() []string) (backendplugin.Plugin, error) {
|
||||
return &grpcPlugin{
|
||||
descriptor: descriptor,
|
||||
logger: logger,
|
||||
clientFactory: func() *plugin.Client {
|
||||
return plugin.NewClient(newClientConfig(descriptor.executablePath, descriptor.executableArgs, env(), logger, descriptor.versionedPlugins))
|
||||
},
|
||||
}, nil
|
||||
return newGrpcPlugin(descriptor, logger, env), nil
|
||||
}
|
||||
}
|
||||
|
||||
func newGrpcPlugin(descriptor PluginDescriptor, logger log.Logger, env func() []string) *grpcPlugin {
|
||||
return &grpcPlugin{
|
||||
descriptor: descriptor,
|
||||
logger: logger,
|
||||
clientFactory: func() *plugin.Client {
|
||||
return plugin.NewClient(newClientConfig(descriptor.executablePath, descriptor.executableArgs, env(), logger, descriptor.versionedPlugins))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user