]>
Commit | Line | Data |
---|---|---|
bae9f6d2 JC |
1 | // The plugin package exposes functions and helpers for communicating to |
2 | // plugins which are implemented as standalone binary applications. | |
3 | // | |
4 | // plugin.Client fully manages the lifecycle of executing the application, | |
5 | // connecting to it, and returning the RPC client for dispensing plugins. | |
6 | // | |
7 | // plugin.Serve fully manages listeners to expose an RPC server from a binary | |
8 | // that plugin.Client can connect to. | |
9 | package plugin | |
10 | ||
11 | import ( | |
12 | "net/rpc" | |
13 | ) | |
14 | ||
15 | // Plugin is the interface that is implemented to serve/connect to an | |
16 | // inteface implementation. | |
17 | type Plugin interface { | |
18 | // Server should return the RPC server compatible struct to serve | |
19 | // the methods that the Client calls over net/rpc. | |
20 | Server(*MuxBroker) (interface{}, error) | |
21 | ||
22 | // Client returns an interface implementation for the plugin you're | |
23 | // serving that communicates to the server end of the plugin. | |
24 | Client(*MuxBroker, *rpc.Client) (interface{}, error) | |
25 | } |