Merge pull request #20319 from hashicorp/jbardin/go-plugin

update go-plugin
This commit is contained in:
James Bardin 2019-02-12 20:59:31 -05:00 committed by GitHub
commit 303e5cc82e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 68 additions and 64 deletions

2
go.mod
View File

@ -56,7 +56,7 @@ require (
github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa // indirect github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa // indirect
github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect github.com/hashicorp/go-msgpack v0.0.0-20150518234257-fa3f63826f7c // indirect
github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-plugin v0.0.0-20190129155509-362c99b11937 github.com/hashicorp/go-plugin v0.0.0-20190212232519-b838ffee39ce
github.com/hashicorp/go-retryablehttp v0.5.1 github.com/hashicorp/go-retryablehttp v0.5.1
github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect

2
go.sum
View File

@ -150,6 +150,8 @@ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHh
github.com/hashicorp/go-plugin v0.0.0-20170816151819-a5174f84d7f8/go.mod h1:JSqWYsict+jzcj0+xElxyrBQRPNoiWQuddnxArJ7XHQ= github.com/hashicorp/go-plugin v0.0.0-20170816151819-a5174f84d7f8/go.mod h1:JSqWYsict+jzcj0+xElxyrBQRPNoiWQuddnxArJ7XHQ=
github.com/hashicorp/go-plugin v0.0.0-20190129155509-362c99b11937 h1:F3biNWiyQYD6ch5Y/Kua5DKZKH3R0NtCvnv+KhZei20= github.com/hashicorp/go-plugin v0.0.0-20190129155509-362c99b11937 h1:F3biNWiyQYD6ch5Y/Kua5DKZKH3R0NtCvnv+KhZei20=
github.com/hashicorp/go-plugin v0.0.0-20190129155509-362c99b11937/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v0.0.0-20190129155509-362c99b11937/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
github.com/hashicorp/go-plugin v0.0.0-20190212232519-b838ffee39ce h1:I3KJUf8jyMubLFeHit2ibr9YeVxJX2CXMXVM6xlB+Qk=
github.com/hashicorp/go-plugin v0.0.0-20190212232519-b838ffee39ce/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
github.com/hashicorp/go-retryablehttp v0.5.1 h1:Vsx5XKPqPs3M6sM4U4GWyUqFS8aBiL9U5gkgvpkg4SE= github.com/hashicorp/go-retryablehttp v0.5.1 h1:Vsx5XKPqPs3M6sM4U4GWyUqFS8aBiL9U5gkgvpkg4SE=
github.com/hashicorp/go-retryablehttp v0.5.1/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.5.1/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 h1:VBj0QYQ0u2MCJzBfeYXGexnAl17GsH1yidnoxCqqD9E= github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 h1:VBj0QYQ0u2MCJzBfeYXGexnAl17GsH1yidnoxCqqD9E=

View File

@ -11,7 +11,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/hashicorp/go-plugin/internal/proto" "github.com/hashicorp/go-plugin/internal/plugin"
"github.com/oklog/run" "github.com/oklog/run"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -21,14 +21,14 @@ import (
// streamer interface is used in the broker to send/receive connection // streamer interface is used in the broker to send/receive connection
// information. // information.
type streamer interface { type streamer interface {
Send(*proto.ConnInfo) error Send(*plugin.ConnInfo) error
Recv() (*proto.ConnInfo, error) Recv() (*plugin.ConnInfo, error)
Close() Close()
} }
// sendErr is used to pass errors back during a send. // sendErr is used to pass errors back during a send.
type sendErr struct { type sendErr struct {
i *proto.ConnInfo i *plugin.ConnInfo
ch chan error ch chan error
} }
@ -40,7 +40,7 @@ type gRPCBrokerServer struct {
send chan *sendErr send chan *sendErr
// recv is used to receive connection info from the gRPC stream. // recv is used to receive connection info from the gRPC stream.
recv chan *proto.ConnInfo recv chan *plugin.ConnInfo
// quit closes down the stream. // quit closes down the stream.
quit chan struct{} quit chan struct{}
@ -52,7 +52,7 @@ type gRPCBrokerServer struct {
func newGRPCBrokerServer() *gRPCBrokerServer { func newGRPCBrokerServer() *gRPCBrokerServer {
return &gRPCBrokerServer{ return &gRPCBrokerServer{
send: make(chan *sendErr), send: make(chan *sendErr),
recv: make(chan *proto.ConnInfo), recv: make(chan *plugin.ConnInfo),
quit: make(chan struct{}), quit: make(chan struct{}),
} }
} }
@ -60,7 +60,7 @@ func newGRPCBrokerServer() *gRPCBrokerServer {
// StartStream implements the GRPCBrokerServer interface and will block until // StartStream implements the GRPCBrokerServer interface and will block until
// the quit channel is closed or the context reports Done. The stream will pass // the quit channel is closed or the context reports Done. The stream will pass
// connection information to/from the client. // connection information to/from the client.
func (s *gRPCBrokerServer) StartStream(stream proto.GRPCBroker_StartStreamServer) error { func (s *gRPCBrokerServer) StartStream(stream plugin.GRPCBroker_StartStreamServer) error {
doneCh := stream.Context().Done() doneCh := stream.Context().Done()
defer s.Close() defer s.Close()
@ -99,7 +99,7 @@ func (s *gRPCBrokerServer) StartStream(stream proto.GRPCBroker_StartStreamServer
// Send is used by the GRPCBroker to pass connection information into the stream // Send is used by the GRPCBroker to pass connection information into the stream
// to the client. // to the client.
func (s *gRPCBrokerServer) Send(i *proto.ConnInfo) error { func (s *gRPCBrokerServer) Send(i *plugin.ConnInfo) error {
ch := make(chan error) ch := make(chan error)
defer close(ch) defer close(ch)
@ -117,7 +117,7 @@ func (s *gRPCBrokerServer) Send(i *proto.ConnInfo) error {
// Recv is used by the GRPCBroker to pass connection information that has been // Recv is used by the GRPCBroker to pass connection information that has been
// sent from the client from the stream to the broker. // sent from the client from the stream to the broker.
func (s *gRPCBrokerServer) Recv() (*proto.ConnInfo, error) { func (s *gRPCBrokerServer) Recv() (*plugin.ConnInfo, error) {
select { select {
case <-s.quit: case <-s.quit:
return nil, errors.New("broker closed") return nil, errors.New("broker closed")
@ -138,13 +138,13 @@ func (s *gRPCBrokerServer) Close() {
// streamer interfaces. // streamer interfaces.
type gRPCBrokerClientImpl struct { type gRPCBrokerClientImpl struct {
// client is the underlying GRPC client used to make calls to the server. // client is the underlying GRPC client used to make calls to the server.
client proto.GRPCBrokerClient client plugin.GRPCBrokerClient
// send is used to send connection info to the gRPC stream. // send is used to send connection info to the gRPC stream.
send chan *sendErr send chan *sendErr
// recv is used to receive connection info from the gRPC stream. // recv is used to receive connection info from the gRPC stream.
recv chan *proto.ConnInfo recv chan *plugin.ConnInfo
// quit closes down the stream. // quit closes down the stream.
quit chan struct{} quit chan struct{}
@ -155,9 +155,9 @@ type gRPCBrokerClientImpl struct {
func newGRPCBrokerClient(conn *grpc.ClientConn) *gRPCBrokerClientImpl { func newGRPCBrokerClient(conn *grpc.ClientConn) *gRPCBrokerClientImpl {
return &gRPCBrokerClientImpl{ return &gRPCBrokerClientImpl{
client: proto.NewGRPCBrokerClient(conn), client: plugin.NewGRPCBrokerClient(conn),
send: make(chan *sendErr), send: make(chan *sendErr),
recv: make(chan *proto.ConnInfo), recv: make(chan *plugin.ConnInfo),
quit: make(chan struct{}), quit: make(chan struct{}),
} }
} }
@ -209,7 +209,7 @@ func (s *gRPCBrokerClientImpl) StartStream() error {
// Send is used by the GRPCBroker to pass connection information into the stream // Send is used by the GRPCBroker to pass connection information into the stream
// to the plugin. // to the plugin.
func (s *gRPCBrokerClientImpl) Send(i *proto.ConnInfo) error { func (s *gRPCBrokerClientImpl) Send(i *plugin.ConnInfo) error {
ch := make(chan error) ch := make(chan error)
defer close(ch) defer close(ch)
@ -227,7 +227,7 @@ func (s *gRPCBrokerClientImpl) Send(i *proto.ConnInfo) error {
// Recv is used by the GRPCBroker to pass connection information that has been // Recv is used by the GRPCBroker to pass connection information that has been
// sent from the plugin to the broker. // sent from the plugin to the broker.
func (s *gRPCBrokerClientImpl) Recv() (*proto.ConnInfo, error) { func (s *gRPCBrokerClientImpl) Recv() (*plugin.ConnInfo, error) {
select { select {
case <-s.quit: case <-s.quit:
return nil, errors.New("broker closed") return nil, errors.New("broker closed")
@ -268,7 +268,7 @@ type GRPCBroker struct {
} }
type gRPCBrokerPending struct { type gRPCBrokerPending struct {
ch chan *proto.ConnInfo ch chan *plugin.ConnInfo
doneCh chan struct{} doneCh chan struct{}
} }
@ -290,7 +290,7 @@ func (b *GRPCBroker) Accept(id uint32) (net.Listener, error) {
return nil, err return nil, err
} }
err = b.streamer.Send(&proto.ConnInfo{ err = b.streamer.Send(&plugin.ConnInfo{
ServiceId: id, ServiceId: id,
Network: listener.Addr().Network(), Network: listener.Addr().Network(),
Address: listener.Addr().String(), Address: listener.Addr().String(),
@ -365,7 +365,7 @@ func (b *GRPCBroker) Close() error {
// Dial opens a connection by ID. // Dial opens a connection by ID.
func (b *GRPCBroker) Dial(id uint32) (conn *grpc.ClientConn, err error) { func (b *GRPCBroker) Dial(id uint32) (conn *grpc.ClientConn, err error) {
var c *proto.ConnInfo var c *plugin.ConnInfo
// Open the stream // Open the stream
p := b.getStream(id) p := b.getStream(id)
@ -435,7 +435,7 @@ func (m *GRPCBroker) getStream(id uint32) *gRPCBrokerPending {
} }
m.streams[id] = &gRPCBrokerPending{ m.streams[id] = &gRPCBrokerPending{
ch: make(chan *proto.ConnInfo, 1), ch: make(chan *plugin.ConnInfo, 1),
doneCh: make(chan struct{}), doneCh: make(chan struct{}),
} }
return m.streams[id] return m.streams[id]

View File

@ -6,7 +6,7 @@ import (
"net" "net"
"time" "time"
"github.com/hashicorp/go-plugin/internal/proto" "github.com/hashicorp/go-plugin/internal/plugin"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
@ -61,7 +61,7 @@ func newGRPCClient(doneCtx context.Context, c *Client) (*GRPCClient, error) {
Plugins: c.config.Plugins, Plugins: c.config.Plugins,
doneCtx: doneCtx, doneCtx: doneCtx,
broker: broker, broker: broker,
controller: proto.NewGRPCControllerClient(conn), controller: plugin.NewGRPCControllerClient(conn),
} }
return cl, nil return cl, nil
@ -75,13 +75,13 @@ type GRPCClient struct {
doneCtx context.Context doneCtx context.Context
broker *GRPCBroker broker *GRPCBroker
controller proto.GRPCControllerClient controller plugin.GRPCControllerClient
} }
// ClientProtocol impl. // ClientProtocol impl.
func (c *GRPCClient) Close() error { func (c *GRPCClient) Close() error {
c.broker.Close() c.broker.Close()
c.controller.Shutdown(c.doneCtx, &proto.Empty{}) c.controller.Shutdown(c.doneCtx, &plugin.Empty{})
return c.Conn.Close() return c.Conn.Close()
} }

View File

@ -3,7 +3,7 @@ package plugin
import ( import (
"context" "context"
"github.com/hashicorp/go-plugin/internal/proto" "github.com/hashicorp/go-plugin/internal/plugin"
) )
// GRPCControllerServer handles shutdown calls to terminate the server when the // GRPCControllerServer handles shutdown calls to terminate the server when the
@ -14,8 +14,8 @@ type grpcControllerServer struct {
// Shutdown stops the grpc server. It first will attempt a graceful stop, then a // Shutdown stops the grpc server. It first will attempt a graceful stop, then a
// full stop on the server. // full stop on the server.
func (s *grpcControllerServer) Shutdown(ctx context.Context, _ *proto.Empty) (*proto.Empty, error) { func (s *grpcControllerServer) Shutdown(ctx context.Context, _ *plugin.Empty) (*plugin.Empty, error) {
resp := &proto.Empty{} resp := &plugin.Empty{}
// TODO: figure out why GracefullStop doesn't work. // TODO: figure out why GracefullStop doesn't work.
s.server.Stop() s.server.Stop()

View File

@ -9,7 +9,7 @@ import (
"net" "net"
hclog "github.com/hashicorp/go-hclog" hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin/internal/proto" "github.com/hashicorp/go-plugin/internal/plugin"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"google.golang.org/grpc/health" "google.golang.org/grpc/health"
@ -75,7 +75,7 @@ func (s *GRPCServer) Init() error {
// Register the broker service // Register the broker service
brokerServer := newGRPCBrokerServer() brokerServer := newGRPCBrokerServer()
proto.RegisterGRPCBrokerServer(s.server, brokerServer) plugin.RegisterGRPCBrokerServer(s.server, brokerServer)
s.broker = newGRPCBroker(brokerServer, s.TLS) s.broker = newGRPCBroker(brokerServer, s.TLS)
go s.broker.Run() go s.broker.Run()
@ -83,7 +83,7 @@ func (s *GRPCServer) Init() error {
controllerServer := &grpcControllerServer{ controllerServer := &grpcControllerServer{
server: s, server: s,
} }
proto.RegisterGRPCControllerServer(s.server, controllerServer) plugin.RegisterGRPCControllerServer(s.server, controllerServer)
// Register all our plugins onto the gRPC server. // Register all our plugins onto the gRPC server.
for k, raw := range s.Plugins { for k, raw := range s.Plugins {

View File

@ -1,3 +1,3 @@
//go:generate protoc -I ./ ./grpc_broker.proto ./grpc_controller.proto --go_out=plugins=grpc:. //go:generate protoc -I ./ ./grpc_broker.proto ./grpc_controller.proto --go_out=plugins=grpc:.
package proto package plugin

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: grpc_broker.proto // source: grpc_broker.proto
package proto package plugin
import ( import (
fmt "fmt" fmt "fmt"
@ -78,24 +78,24 @@ func (m *ConnInfo) GetAddress() string {
} }
func init() { func init() {
proto.RegisterType((*ConnInfo)(nil), "proto.ConnInfo") proto.RegisterType((*ConnInfo)(nil), "plugin.ConnInfo")
} }
func init() { proto.RegisterFile("grpc_broker.proto", fileDescriptor_802e9beed3ec3b28) } func init() { proto.RegisterFile("grpc_broker.proto", fileDescriptor_802e9beed3ec3b28) }
var fileDescriptor_802e9beed3ec3b28 = []byte{ var fileDescriptor_802e9beed3ec3b28 = []byte{
// 164 bytes of a gzipped FileDescriptorProto // 175 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0x2f, 0x2a, 0x48, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0x2f, 0x2a, 0x48,
0x8e, 0x4f, 0x2a, 0xca, 0xcf, 0x4e, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x8e, 0x4f, 0x2a, 0xca, 0xcf, 0x4e, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2b,
0x53, 0x4a, 0xb1, 0x5c, 0x1c, 0xce, 0xf9, 0x79, 0x79, 0x9e, 0x79, 0x69, 0xf9, 0x42, 0xb2, 0x5c, 0xc8, 0x29, 0x4d, 0xcf, 0xcc, 0x53, 0x8a, 0xe5, 0xe2, 0x70, 0xce, 0xcf, 0xcb, 0xf3, 0xcc, 0x4b,
0x5c, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, 0xa9, 0xf1, 0x99, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcb, 0x17, 0x92, 0xe5, 0xe2, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x8d, 0xcf, 0x4c, 0x91,
0xbc, 0x41, 0x9c, 0x50, 0x11, 0xcf, 0x14, 0x21, 0x09, 0x2e, 0xf6, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0xe2, 0x84, 0x8a, 0x78, 0xa6, 0x08, 0x49, 0x70, 0xb1, 0xe7,
0xa2, 0x6c, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x18, 0x17, 0x24, 0x93, 0x98, 0x92, 0x52, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0x4b, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x06, 0xc1, 0xb8, 0x20,
0x94, 0x5a, 0x5c, 0x2c, 0xc1, 0x0c, 0x91, 0x81, 0x72, 0x8d, 0x1c, 0xb9, 0xb8, 0xdc, 0x83, 0x02, 0x99, 0xc4, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0x62, 0x09, 0x66, 0x88, 0x0c, 0x94, 0x6b, 0xe4, 0xcc,
0x9c, 0x9d, 0xc0, 0x36, 0x0b, 0x19, 0x73, 0x71, 0x07, 0x97, 0x24, 0x16, 0x95, 0x04, 0x97, 0x14, 0xc5, 0xe5, 0x1e, 0x14, 0xe0, 0xec, 0x04, 0xb6, 0x5a, 0xc8, 0x94, 0x8b, 0x3b, 0xb8, 0x24, 0xb1,
0xa5, 0x26, 0xe6, 0x0a, 0xf1, 0x43, 0x9c, 0xa2, 0x07, 0x73, 0x80, 0x14, 0xba, 0x80, 0x06, 0xa3, 0xa8, 0x24, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0x57, 0x48, 0x40, 0x0f, 0xe2, 0x08, 0x3d, 0x98, 0x0b,
0x01, 0x63, 0x12, 0x1b, 0x58, 0xcc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x7a, 0xda, 0xd5, 0x84, 0xa4, 0x30, 0x44, 0x34, 0x18, 0x0d, 0x18, 0x9d, 0x38, 0xa2, 0xa0, 0xae, 0x4d, 0x62, 0x03, 0x3b,
0xc4, 0x00, 0x00, 0x00, 0xde, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x10, 0x15, 0x39, 0x47, 0xd1, 0x00, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -122,7 +122,7 @@ func NewGRPCBrokerClient(cc *grpc.ClientConn) GRPCBrokerClient {
} }
func (c *gRPCBrokerClient) StartStream(ctx context.Context, opts ...grpc.CallOption) (GRPCBroker_StartStreamClient, error) { func (c *gRPCBrokerClient) StartStream(ctx context.Context, opts ...grpc.CallOption) (GRPCBroker_StartStreamClient, error) {
stream, err := c.cc.NewStream(ctx, &_GRPCBroker_serviceDesc.Streams[0], "/proto.GRPCBroker/StartStream", opts...) stream, err := c.cc.NewStream(ctx, &_GRPCBroker_serviceDesc.Streams[0], "/plugin.GRPCBroker/StartStream", opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -188,7 +188,7 @@ func (x *gRPCBrokerStartStreamServer) Recv() (*ConnInfo, error) {
} }
var _GRPCBroker_serviceDesc = grpc.ServiceDesc{ var _GRPCBroker_serviceDesc = grpc.ServiceDesc{
ServiceName: "proto.GRPCBroker", ServiceName: "plugin.GRPCBroker",
HandlerType: (*GRPCBrokerServer)(nil), HandlerType: (*GRPCBrokerServer)(nil),
Methods: []grpc.MethodDesc{}, Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{ Streams: []grpc.StreamDesc{

View File

@ -1,5 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package proto; package plugin;
option go_package = "plugin";
message ConnInfo { message ConnInfo {
uint32 service_id = 1; uint32 service_id = 1;

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: grpc_controller.proto // source: grpc_controller.proto
package proto package plugin
import ( import (
fmt "fmt" fmt "fmt"
@ -54,20 +54,20 @@ func (m *Empty) XXX_DiscardUnknown() {
var xxx_messageInfo_Empty proto.InternalMessageInfo var xxx_messageInfo_Empty proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*Empty)(nil), "proto.Empty") proto.RegisterType((*Empty)(nil), "plugin.Empty")
} }
func init() { proto.RegisterFile("grpc_controller.proto", fileDescriptor_23c2c7e42feab570) } func init() { proto.RegisterFile("grpc_controller.proto", fileDescriptor_23c2c7e42feab570) }
var fileDescriptor_23c2c7e42feab570 = []byte{ var fileDescriptor_23c2c7e42feab570 = []byte{
// 97 bytes of a gzipped FileDescriptorProto // 108 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x2f, 0x2a, 0x48, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0x2f, 0x2a, 0x48,
0x8e, 0x4f, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf, 0xc9, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0x8e, 0x4f, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf, 0xc9, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f,
0xc9, 0x17, 0x62, 0x05, 0x53, 0x4a, 0xec, 0x5c, 0xac, 0xae, 0xb9, 0x05, 0x25, 0x95, 0x46, 0x16, 0xc9, 0x17, 0x62, 0x2b, 0xc8, 0x29, 0x4d, 0xcf, 0xcc, 0x53, 0x62, 0xe7, 0x62, 0x75, 0xcd, 0x2d,
0x5c, 0x7c, 0xee, 0x41, 0x01, 0xce, 0xce, 0x70, 0x75, 0x42, 0x6a, 0x5c, 0x1c, 0xc1, 0x19, 0xa5, 0x28, 0xa9, 0x34, 0xb2, 0xe2, 0xe2, 0x73, 0x0f, 0x0a, 0x70, 0x76, 0x86, 0x2b, 0x14, 0xd2, 0xe0,
0x25, 0x29, 0xf9, 0xe5, 0x79, 0x42, 0x3c, 0x10, 0x5d, 0x7a, 0x60, 0xb5, 0x52, 0x28, 0xbc, 0x24, 0xe2, 0x08, 0xce, 0x28, 0x2d, 0x49, 0xc9, 0x2f, 0xcf, 0x13, 0xe2, 0xd5, 0x83, 0xa8, 0xd7, 0x03,
0x36, 0x30, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x69, 0xa1, 0xad, 0x79, 0x69, 0x00, 0x00, 0x2b, 0x96, 0x42, 0xe5, 0x3a, 0x71, 0x44, 0x41, 0x8d, 0x4b, 0x62, 0x03, 0x9b, 0x6e, 0x0c, 0x08,
0x00, 0x00, 0x00, 0xff, 0xff, 0xab, 0x7c, 0x27, 0xe5, 0x76, 0x00, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -95,7 +95,7 @@ func NewGRPCControllerClient(cc *grpc.ClientConn) GRPCControllerClient {
func (c *gRPCControllerClient) Shutdown(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { func (c *gRPCControllerClient) Shutdown(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty) out := new(Empty)
err := c.cc.Invoke(ctx, "/proto.GRPCController/Shutdown", in, out, opts...) err := c.cc.Invoke(ctx, "/plugin.GRPCController/Shutdown", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -121,7 +121,7 @@ func _GRPCController_Shutdown_Handler(srv interface{}, ctx context.Context, dec
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.GRPCController/Shutdown", FullMethod: "/plugin.GRPCController/Shutdown",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GRPCControllerServer).Shutdown(ctx, req.(*Empty)) return srv.(GRPCControllerServer).Shutdown(ctx, req.(*Empty))
@ -130,7 +130,7 @@ func _GRPCController_Shutdown_Handler(srv interface{}, ctx context.Context, dec
} }
var _GRPCController_serviceDesc = grpc.ServiceDesc{ var _GRPCController_serviceDesc = grpc.ServiceDesc{
ServiceName: "proto.GRPCController", ServiceName: "plugin.GRPCController",
HandlerType: (*GRPCControllerServer)(nil), HandlerType: (*GRPCControllerServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {

View File

@ -1,5 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package proto; package plugin;
option go_package = "plugin";
message Empty { message Empty {
} }

View File

@ -7,9 +7,9 @@ import (
"net" "net"
"net/rpc" "net/rpc"
hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin/internal/proto"
"github.com/mitchellh/go-testing-interface" "github.com/mitchellh/go-testing-interface"
hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin/internal/plugin"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -173,7 +173,7 @@ func TestPluginGRPCConn(t testing.T, ps map[string]Plugin) (*GRPCClient, *GRPCSe
Plugins: ps, Plugins: ps,
broker: broker, broker: broker,
doneCtx: context.Background(), doneCtx: context.Background(),
controller: proto.NewGRPCControllerClient(conn), controller: plugin.NewGRPCControllerClient(conn),
} }
return client, server return client, server

4
vendor/modules.txt vendored
View File

@ -389,9 +389,9 @@ github.com/hashicorp/go-getter/helper/url
github.com/hashicorp/go-hclog github.com/hashicorp/go-hclog
# github.com/hashicorp/go-multierror v1.0.0 # github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-multierror github.com/hashicorp/go-multierror
# github.com/hashicorp/go-plugin v0.0.0-20190129155509-362c99b11937 # github.com/hashicorp/go-plugin v0.0.0-20190212232519-b838ffee39ce
github.com/hashicorp/go-plugin github.com/hashicorp/go-plugin
github.com/hashicorp/go-plugin/internal/proto github.com/hashicorp/go-plugin/internal/plugin
# github.com/hashicorp/go-retryablehttp v0.5.1 # github.com/hashicorp/go-retryablehttp v0.5.1
github.com/hashicorp/go-retryablehttp github.com/hashicorp/go-retryablehttp
# github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 # github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90