package
0.1.3
Repository: https://github.com/golocron/rpcz.git
Documentation: pkg.go.dev

# 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:

NameTypeMeaning
kindint32Holds the encoding of a request.
iduint64Specifies the unique id of a request, set by the client.
servicestringThe target service the client is requesting.
methodstringThe method on the service the client is calling.
databytesProtbuf-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:

NameTypeMeaning
kindint32Holds the encoding of a request.
iduint64Specifies the unique id of a request, set by the client.
servicestringThe target service the client is requesting.
methodstringThe method on the service the client is calling.
errorstringHolds the error returned by the method.
databytesProtbuf-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.