# README
Wire
This is an internal package that defines the communication protocol for rpcz
.
The definitions can be generated by running:
protoc -I=./ --go_out=./ --go_opt=paths=source_relative ./wire.proto
Request
A request is represented by the Request
type. Its fileds have the following characteristics:
Name | Type | Meaning |
---|---|---|
kind | int32 | Holds the encoding of a request. |
id | uint64 | Specifies the unique id of a request, set by the client. |
service | string | The target service the client is requesting. |
method | string | The method on the service the client is calling. |
data | bytes | Protbuf-encoded* arguments of the request. |
This is used to encode any type of arguments. Both client and server encoders take care of properly dealing with this. It's a simplified version of the official method for encoding a value of any type using Protobuf. We just don't send the type information since it's already known by the server from the methods' signatures.
Response
A response is represented similarly to Request
with one extra field for an error:
Name | Type | Meaning |
---|---|---|
kind | int32 | Holds the encoding of a request. |
id | uint64 | Specifies the unique id of a request, set by the client. |
service | string | The target service the client is requesting. |
method | string | The method on the service the client is calling. |
error | string | Holds the error returned by the method. |
data | bytes | Protbuf-encoded* arguments of the request. |
See the explanation above for the Request
type.
Invalid Request
The InvalidRequest
type is used as a body on a response that has resulted into an error.