mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 04:21:50 +08:00
28 lines
615 B
Go
28 lines
615 B
Go
package tsdb
|
|
|
|
import (
|
|
"context"
|
|
|
|
proto "github.com/grafana/grafana/pkg/tsdb/models"
|
|
plugin "github.com/hashicorp/go-plugin"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type TsdbPlugin interface {
|
|
Query(ctx context.Context, req *proto.TsdbQuery) (*proto.Response, error)
|
|
}
|
|
|
|
type TsdbPluginImpl struct {
|
|
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
|
|
}
|