separate plugin impl and proto files

This commit is contained in:
bergquist 2017-09-21 17:02:40 +02:00
parent 0bc5bf53ce
commit a2d47427ba
12 changed files with 11 additions and 24 deletions

View File

@ -26,3 +26,6 @@ test: test-go test-js
run: run:
./bin/grafana-server ./bin/grafana-server
pbuf:
protoc -I pkg/tsdb/models pkg/tsdb/models/*.proto --go_out=plugins=grpc:pkg/tsdb/models/.

View File

@ -22,6 +22,7 @@ import (
"github.com/grafana/grafana/pkg/metrics" "github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins"
tsdbplugins "github.com/grafana/grafana/pkg/plugins/backend"
"github.com/grafana/grafana/pkg/services/alerting" "github.com/grafana/grafana/pkg/services/alerting"
"github.com/grafana/grafana/pkg/services/cleanup" "github.com/grafana/grafana/pkg/services/cleanup"
"github.com/grafana/grafana/pkg/services/notifications" "github.com/grafana/grafana/pkg/services/notifications"
@ -31,7 +32,6 @@ import (
"github.com/grafana/grafana/pkg/social" "github.com/grafana/grafana/pkg/social"
"github.com/grafana/grafana/pkg/tracing" "github.com/grafana/grafana/pkg/tracing"
tsdbplugins "github.com/grafana/grafana/pkg/tsdb/plugins"
) )
func NewGrafanaServer() models.GrafanaServer { func NewGrafanaServer() models.GrafanaServer {

View File

@ -5,8 +5,8 @@ import (
"log" "log"
"github.com/grafana/grafana/pkg/tsdb/plugins/proto" shared "github.com/grafana/grafana/pkg/plugins/backend/shared"
shared "github.com/grafana/grafana/pkg/tsdb/plugins/shared" proto "github.com/grafana/grafana/pkg/tsdb/models"
plugin "github.com/hashicorp/go-plugin" plugin "github.com/hashicorp/go-plugin"
) )

View File

@ -6,8 +6,8 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/tsdb/plugins/proto" "github.com/grafana/grafana/pkg/plugins/backend/shared"
"github.com/grafana/grafana/pkg/tsdb/plugins/shared" "github.com/grafana/grafana/pkg/tsdb/models"
plugin "github.com/hashicorp/go-plugin" plugin "github.com/hashicorp/go-plugin"
) )
@ -25,7 +25,7 @@ func Init() (*plugin.Client, error) {
MagicCookieValue: "hello", MagicCookieValue: "hello",
}, },
Plugins: shared.PluginMap, Plugins: shared.PluginMap,
Cmd: exec.Command("sh", "-c", "/home/carl/go/src/github.com/grafana/grafana/pkg/tsdb/plugins/mock_tsdb_plugin/simple-plugin"), Cmd: exec.Command("sh", "-c", "/home/carl/go/src/github.com/grafana/grafana/pkg/plugins/backend/mock_tsdb_plugin/simple-plugin"),
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
Logger: logWrapper{logger: logger}, Logger: logWrapper{logger: logger},
}) })

View File

@ -1,7 +1,7 @@
package shared package shared
import ( import (
proto "github.com/grafana/grafana/pkg/tsdb/plugins/proto" proto "github.com/grafana/grafana/pkg/tsdb/models"
"golang.org/x/net/context" "golang.org/x/net/context"
) )

View File

@ -3,7 +3,7 @@ package shared
import ( import (
"golang.org/x/net/context" "golang.org/x/net/context"
proto "github.com/grafana/grafana/pkg/tsdb/plugins/proto" proto "github.com/grafana/grafana/pkg/tsdb/models"
plugin "github.com/hashicorp/go-plugin" plugin "github.com/hashicorp/go-plugin"
"google.golang.org/grpc" "google.golang.org/grpc"
) )

View File

@ -1,16 +0,0 @@
#/bin/sh
#protoc -I/usr/local/include -I. \
# -I$GOPATH/src \
# -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
# --go_out=google/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
# pb/service.proto
#protoc -I/usr/local/include -I. \
# -I$GOPATH/src \
# -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
# --go_out=google/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
# pb/service.proto
protoc -I proto/ proto/tsdb_plugin.proto --go_out=plugins=grpc:tsdb_plugin