diff options
Diffstat (limited to 'vendor/github.com/hashicorp/go-plugin/plugin.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-plugin/plugin.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-plugin/plugin.go b/vendor/github.com/hashicorp/go-plugin/plugin.go index 37c8fd6..79d9674 100644 --- a/vendor/github.com/hashicorp/go-plugin/plugin.go +++ b/vendor/github.com/hashicorp/go-plugin/plugin.go | |||
@@ -9,7 +9,11 @@ | |||
9 | package plugin | 9 | package plugin |
10 | 10 | ||
11 | import ( | 11 | import ( |
12 | "context" | ||
13 | "errors" | ||
12 | "net/rpc" | 14 | "net/rpc" |
15 | |||
16 | "google.golang.org/grpc" | ||
13 | ) | 17 | ) |
14 | 18 | ||
15 | // Plugin is the interface that is implemented to serve/connect to an | 19 | // Plugin is the interface that is implemented to serve/connect to an |
@@ -23,3 +27,32 @@ type Plugin interface { | |||
23 | // serving that communicates to the server end of the plugin. | 27 | // serving that communicates to the server end of the plugin. |
24 | Client(*MuxBroker, *rpc.Client) (interface{}, error) | 28 | Client(*MuxBroker, *rpc.Client) (interface{}, error) |
25 | } | 29 | } |
30 | |||
31 | // GRPCPlugin is the interface that is implemented to serve/connect to | ||
32 | // a plugin over gRPC. | ||
33 | type GRPCPlugin interface { | ||
34 | // GRPCServer should register this plugin for serving with the | ||
35 | // given GRPCServer. Unlike Plugin.Server, this is only called once | ||
36 | // since gRPC plugins serve singletons. | ||
37 | GRPCServer(*GRPCBroker, *grpc.Server) error | ||
38 | |||
39 | // GRPCClient should return the interface implementation for the plugin | ||
40 | // you're serving via gRPC. The provided context will be canceled by | ||
41 | // go-plugin in the event of the plugin process exiting. | ||
42 | GRPCClient(context.Context, *GRPCBroker, *grpc.ClientConn) (interface{}, error) | ||
43 | } | ||
44 | |||
45 | // NetRPCUnsupportedPlugin implements Plugin but returns errors for the | ||
46 | // Server and Client functions. This will effectively disable support for | ||
47 | // net/rpc based plugins. | ||
48 | // | ||
49 | // This struct can be embedded in your struct. | ||
50 | type NetRPCUnsupportedPlugin struct{} | ||
51 | |||
52 | func (p NetRPCUnsupportedPlugin) Server(*MuxBroker) (interface{}, error) { | ||
53 | return nil, errors.New("net/rpc plugin protocol not supported") | ||
54 | } | ||
55 | |||
56 | func (p NetRPCUnsupportedPlugin) Client(*MuxBroker, *rpc.Client) (interface{}, error) { | ||
57 | return nil, errors.New("net/rpc plugin protocol not supported") | ||
58 | } | ||