Files
steampipe/pkg/pluginmanager_service/grpc/shared/grpc.go
kaidaguerre 40804a3201 Execute RefreshConnections asyncronously and optimise for high connection count. Add connection_state table.
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents

 Closes #3394
 Closes #3267
2023-05-10 09:05:08 +01:00

45 lines
1.4 KiB
Go

package shared
import (
"context"
"github.com/turbot/steampipe/pkg/pluginmanager_service/grpc/proto"
)
// GRPCClient is an implementation of PluginManager service that talks over GRPC.
type GRPCClient struct {
// Proto client use to make the grpc service calls.
client proto.PluginManagerClient
// this context is created by the plugin package, and is canceled when the
// plugin process ends.
ctx context.Context
}
func (c *GRPCClient) Get(req *proto.GetRequest) (*proto.GetResponse, error) {
return c.client.Get(c.ctx, req)
}
func (c *GRPCClient) RefreshConnections(req *proto.RefreshConnectionsRequest) (*proto.RefreshConnectionsResponse, error) {
return c.client.RefreshConnections(c.ctx, req)
}
func (c *GRPCClient) Shutdown(req *proto.ShutdownRequest) (*proto.ShutdownResponse, error) {
return c.client.Shutdown(c.ctx, req)
}
// GRPCServer is the gRPC server that GRPCClient talks to.
type GRPCServer struct {
proto.UnimplementedPluginManagerServer
// This is the real implementation
Impl PluginManager
}
func (m *GRPCServer) Get(_ context.Context, req *proto.GetRequest) (*proto.GetResponse, error) {
return m.Impl.Get(req)
}
func (m *GRPCServer) RefreshConnections(_ context.Context, req *proto.RefreshConnectionsRequest) (*proto.RefreshConnectionsResponse, error) {
return m.Impl.RefreshConnections(req)
}
func (m *GRPCServer) Shutdown(_ context.Context, req *proto.ShutdownRequest) (*proto.ShutdownResponse, error) {
return m.Impl.Shutdown(req)
}