initial version of proto files
This commit is contained in:
1 parent
7b81ebc991
commit
a97360ab27
5 files changed
+359
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
|
||||
proto "github.com/grafana/grafana/pkg/tsdb/plugins/proto"
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
var PluginMap = map[string]plugin.Plugin{
|
||||
"tsdb_mock": &TsdbPluginImpl{},
|
||||
}
|
||||
|
||||
var Handshake = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "BASIC_PLUGIN",
|
||||
MagicCookieValue: "hello",
|
||||
}
|
||||
|
||||
type TsdbPlugin interface {
|
||||
Get(ctx context.Context, req *proto.TsdbRequest) (*proto.TsdbResponse, error)
|
||||
}
|
||||
|
||||
type TsdbPluginImpl struct { //LOL IMPL LOL
|
||||
plugin.NetRPCUnsupportedPlugin
|
||||
Plugin TsdbPlugin
|
||||
}
|
||||
|
||||
func (p *TsdbPluginImpl) GRPCServer(s *grpc.Server) error {
|
||||
proto.RegisterTsdbPluginServer(s, &GRPCServer{p.Plugin})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *TsdbPluginImpl) GRPCClient(c *grpc.ClientConn) (interface{}, error) {
|
||||
return &GRPCClient{proto.NewTsdbPluginClient(c)}, nil
|
||||
}
|
||||
Reference in new issue
Block a user