77
88The Golang library for [ PluginRPC] ( https://github.com/pluginrpc/pluginrpc ) .
99
10- The [ pluginrpc.com/pluginrpc] ( https://pkg.go.dev/pluginrpc.com/pluginrpc ) library
11- provides all the primitives necessary to operate with the PluginRPC ecosystem. The
12- ` protoc-gen-pluginrpc-go ` plugin generates stubs for Protobuf services to work with PluginRPC. It
13- makes authoring and consuming plugins based on Protobuf services incredibly simple.
10+ The [ pluginrpc.com/pluginrpc] ( https://pkg.go.dev/pluginrpc.com/pluginrpc ) library provides all the
11+ primitives necessary to operate with the PluginRPC ecosystem. The ` protoc-gen-pluginrpc-go ` plugin
12+ generates stubs for Protobuf services to work with PluginRPC. It makes authoring and consuming
13+ plugins based on Protobuf services incredibly simple.
1414
1515For more on the motivation behind PluginRPC, see the
1616[ github.com/pluginrpc/pluginrpc] ( https://github.com/pluginrpc/pluginrpc ) documentation.
1717
1818For a full example, see the [ internal/example] ( internal/example ) directory. This contains:
1919
20- - [ proto/pluginrpc/example/v1] ( internal/example/proto/pluginrpc/example/v1 ) : An Protobuf
21- package that contains an example Protobuf service ` EchoService ` .
22- - [ gen/pluginrpc/example/v1] ( internal/example/gen/pluginrpc/example/v1 ) : The generated code
23- from ` protoc-gen-go ` and ` protoc-gen-pluginrpc-go ` for the example Protobuf Package.
24- - [ echo-plugin] ( internal/example/cmd/echo-plugin ) : An implementation of a
25- PluginRPC plugin for ` EchoService ` .
26- - [ echo-request-client] ( internal/example/cmd/echo-request-client ) : A
27- simple client that calls the ` EchoRequest ` RPC via invoking ` echo-plugin ` .
28- - [ echo-list-client] ( internal/example/cmd/echo-request-client ) : A simple
29- client that calls the ` EchoList ` RPC via invoking ` echo-plugin ` .
30- - [ echo-error-client] ( internal/example/cmd/echo-error-client ) : A simple
31- client that calls the ` EchoError ` RPC via invoking ` echo-plugin ` .
20+ - [ proto/pluginrpc/example/v1] ( internal/example/proto/pluginrpc/example/v1 ) : An Protobuf package
21+ that contains an example Protobuf service ` EchoService ` .
22+ - [ gen/pluginrpc/example/v1] ( internal/example/gen/pluginrpc/example/v1 ) : The generated code from
23+ ` protoc-gen-go ` and ` protoc-gen-pluginrpc-go ` for the example Protobuf Package.
24+ - [ echo-plugin] ( internal/example/cmd/echo-plugin ) : An implementation of a PluginRPC plugin for
25+ ` EchoService ` .
26+ - [ echo-request-client] ( internal/example/cmd/echo-request-client ) : A simple client that calls the
27+ ` EchoRequest ` RPC via invoking ` echo-plugin ` .
28+ - [ echo-list-client] ( internal/example/cmd/echo-request-client ) : A simple client that calls the
29+ ` EchoList ` RPC via invoking ` echo-plugin ` .
30+ - [ echo-error-client] ( internal/example/cmd/echo-error-client ) : A simple client that calls the
31+ ` EchoError ` RPC via invoking ` echo-plugin ` .
3232
3333## Usage
3434
@@ -64,9 +64,8 @@ plugins:
6464 opt : paths=source_relative
6565` ` `
6666
67- Build your plugin. See [echo-plugin](internal/example/cmd/echo-plugin) for
68- a full example. Assuming you intend to expose the ` EchoService` as a plugin, your code will look
69- something like this :
67+ Build your plugin. See [echo-plugin](internal/example/cmd/echo-plugin) for a full example. Assuming
68+ you intend to expose the ` EchoService` as a plugin, your code will look something like this:
7069
7170` ` ` go
7271func main() {
@@ -110,8 +109,8 @@ func (echoServiceHandler) EchoError(_ context.Context, request *examplev1.EchoEr
110109` ` `
111110
112111Invoke your plugin. You'll create a client that points to your plugin. See
113- [echo-request-client](internal/example/cmd/echo-request-client) for a full
114- example. Invocation will look something like this :
112+ [echo-request-client](internal/example/cmd/echo-request-client) for a full example. Invocation will
113+ look something like this :
115114
116115` ` ` go
117116client := pluginrpc.NewClient(pluginrpc.NewExecRunner("echo-plugin"))
@@ -129,6 +128,30 @@ response, err := echoServiceClient.EchoRequest(
129128
130129See [pluginrpc_test.go](pluginrpc_test.go) for an example of how to test plugins.
131130
131+ # # Plugin Options
132+
133+ The `protoc-gen-pluginrpc-go` has an option `streaming` that specifies how to handle streaming RPCs.
134+ PluginRPC does not support streaming methods. There are three valid values for `streaming` : ` error` ,
135+ `warn`, `ignore`. The default is `warn` :
136+
137+ - `streaming=error` : The plugin will error if a streaming method is encountered.
138+ - `streaming=warn` : The plugin will produce a warning to stderr if a streaming method is
139+ encountered.
140+ - `streaming=ignore` : The plugin will ignore streaming methods and not produce a warning.
141+
142+ In the case of `warn` or `ignore`, streaming RPCs will be skipped and no functions will be generated
143+ for them. If a service only has streaming RPCs, no interfaces will be generated for this service. If
144+ a file only has services with only streaming RPCs, no file will be generated.
145+
146+ Additionally, `protoc-gen-pluginrpc-go has all the
147+ [standard Go plugin options](https://pkg.go.dev/google.golang.org/[email protected] /compiler/protogen) :
148+
149+ - ` module=<module>`
150+ - ` paths={import,source_relative}`
151+ - ` annotate_code={true,false}`
152+ - ` M<file>=<package>`
153+
154+
132155# # Status: Beta
133156
134157This framework is in active development, and should not be considered stable.
0 commit comments