grpcplugin

package
v0.59.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2020 License: Apache-2.0 Imports: 8 Imported by: 7

Documentation

Overview

Package grpcplugin provides support for serving plugin over gRPC.

This package is internal and meant to be used internally by the SDK and Grafana.

Index

Constants

View Source
const (
	// ProtocolVersion is the current (latest) supported protocol version.
	ProtocolVersion = 2

	// MagicCookieKey is the the magic cookie key that will be used for negotiating
	// between plugin host and client.
	// Should NEVER be changed.
	MagicCookieKey = "grafana_plugin_type"

	// MagicCookieValue is the the magic cookie value that will be used for negotiating
	// between plugin host and client.
	// Should NEVER be changed.
	MagicCookieValue = "datasource"
)

Variables

This section is empty.

Functions

func Serve

func Serve(opts ServeOpts) error

Serve starts serving the plugin over gRPC.

Types

type DataClient

type DataClient interface {
	pluginv2.DataClient
}

type DataGRPCPlugin

type DataGRPCPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	plugin.GRPCPlugin
	DataServer DataServer
}

DataGRPCPlugin implements the GRPCPlugin interface from github.com/hashicorp/go-plugin.

func (*DataGRPCPlugin) GRPCClient

func (p *DataGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*DataGRPCPlugin) GRPCServer

func (p *DataGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type DataServer

type DataServer interface {
	pluginv2.DataServer
}

type DiagnosticsClient

type DiagnosticsClient interface {
	pluginv2.DiagnosticsClient
}

type DiagnosticsGRPCPlugin

type DiagnosticsGRPCPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	plugin.GRPCPlugin
	DiagnosticsServer DiagnosticsServer
}

DiagnosticsGRPCPlugin implements the GRPCPlugin interface from github.com/hashicorp/go-plugin.

func (*DiagnosticsGRPCPlugin) GRPCClient

func (p *DiagnosticsGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*DiagnosticsGRPCPlugin) GRPCServer

func (p *DiagnosticsGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type DiagnosticsServer

type DiagnosticsServer interface {
	pluginv2.DiagnosticsServer
}

type ResourceClient

type ResourceClient interface {
	pluginv2.ResourceClient
}

type ResourceGRPCPlugin

type ResourceGRPCPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	plugin.GRPCPlugin
	ResourceServer ResourceServer
}

ResourceGRPCPlugin implements the GRPCPlugin interface from github.com/hashicorp/go-plugin.

func (*ResourceGRPCPlugin) GRPCClient

func (p *ResourceGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*ResourceGRPCPlugin) GRPCServer

func (p *ResourceGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type ResourceServer

type ResourceServer interface {
	pluginv2.ResourceServer
}

type ServeOpts

type ServeOpts struct {
	DiagnosticsServer DiagnosticsServer
	ResourceServer    ResourceServer
	DataServer        DataServer
	TransformServer   TransformServer

	// GRPCServer factory method for creating GRPC server.
	// If nil, the default one will be used.
	GRPCServer func(options []grpc.ServerOption) *grpc.Server
}

ServeOpts options for serving plugins.

type TransformClient

type TransformClient interface {
	TransformData(ctx context.Context, req *pluginv2.QueryDataRequest, callback TransformDataCallBack) (*pluginv2.QueryDataResponse, error)
}

type TransformDataCallBack

type TransformDataCallBack interface {
	QueryData(ctx context.Context, req *pluginv2.QueryDataRequest) (*pluginv2.QueryDataResponse, error)
}

type TransformGRPCPlugin

type TransformGRPCPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	plugin.GRPCPlugin
	TransformServer TransformServer
}

TransformGRPCPlugin implements the GRPCPlugin interface from github.com/hashicorp/go-plugin.

func (*TransformGRPCPlugin) GRPCClient

func (p *TransformGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*TransformGRPCPlugin) GRPCServer

func (p *TransformGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type TransformServer

type TransformServer interface {
	TransformData(ctx context.Context, req *pluginv2.QueryDataRequest, callback TransformDataCallBack) (*pluginv2.QueryDataResponse, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL