net/rpc ServerCodec / ClientCodec support?

24 views
Skip to first unread message

spencer...@gmail.com

unread,
Nov 7, 2014, 3:32:38 PM11/7/14
to gogopr...@googlegroups.com
Is this planned? I'm going to write it for cockroach in our repo, but would be happier to submit a change to gogoprotobuf to include this support.

Walter Schulze

unread,
Nov 8, 2014, 6:22:55 AM11/8/14
to Spencer Kimball, gogopr...@googlegroups.com
I have no experience with net/rpc, but I had a quick look.
Am I right when I say that you basically just want a copy of net/rpc/jsonrpc with some small modifications for protocol buffers?

On 7 November 2014 22:32, <spencer...@gmail.com> wrote:
Is this planned? I'm going to write it for cockroach in our repo, but would be happier to submit a change to gogoprotobuf to include this support.

--
You received this message because you are subscribed to the Google Groups "gogoprotobuf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gogoprotobuf...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Spencer Kimball

unread,
Nov 10, 2014, 2:27:33 PM11/10/14
to Walter Schulze, gogopr...@googlegroups.com
It's more of a copy of what protorpc has built. It's essentially creating a wire format which sends requests and responses with an ID. Attached is my copy of protorpc using gogoproto...
codec.tgz

Walter Schulze

unread,
Nov 11, 2014, 1:48:02 AM11/11/14
to Spencer Kimball, gogopr...@googlegroups.com
Which protorpc are you talking about, could you provide a link please?

Spencer Kimball

unread,
Nov 11, 2014, 1:56:00 AM11/11/14
to Walter Schulze, gogopr...@googlegroups.com

Walter Schulze

unread,
Nov 11, 2014, 2:05:07 AM11/11/14
to Spencer Kimball, gogopr...@googlegroups.com
Thank you I will definitely have a look.

This looks really promising :)

Spencer Kimball

unread,
Nov 11, 2014, 2:11:57 AM11/11/14
to Walter Schulze, gogopr...@googlegroups.com
I've actually got a change out for review that provides this exactly for gogoprotobuf in cockroach. It's a straight copy of what's in protorpc with some alterations for gogoprotobuf and unit tests. Protorpc is itself a protobuferized translation of what's in net/rpc/jsonrpc. We might consider moving that into gogoprotobuf and improving the unit tests a bit.

Walter Schulze

unread,
Nov 11, 2014, 2:14:53 AM11/11/14
to Spencer Kimball, gogopr...@googlegroups.com
It seems that protorpc is only an rpc protocol between go and c++, or am I missing something?

I would really love it to be cross language or at least include support for java.

Spencer Kimball

unread,
Nov 11, 2014, 11:45:07 AM11/11/14
to Walter Schulze, gogopr...@googlegroups.com
protorpc is just the go-specific pieces needed to use protobufs with Go's native RPC subsystem. So it doesn't apply at all to other languages. I'm attaching a diagram of exactly what the codecs do. They're drawn in green in the diagram. A codec is used by Go's RPC subsystem to translate from a Go-assigned request ID and a Go interface{} (in this case a gogoprotobuf Message type) to bytes, which are sent via TCP and then translated on the other side back into the request ID and an instantiated gogoprotobuf Message.

Inline image 1

Walter Schulze

unread,
Nov 25, 2014, 11:03:46 AM11/25/14
to Spencer Kimball, gogopr...@googlegroups.com
Is the service keyword used to generate any code or is this just a library, like io and fieldpath that you wish to add to gogoprotobuf?

Spencer Kimball

unread,
Nov 25, 2014, 1:12:32 PM11/25/14
to Walter Schulze, gogopr...@googlegroups.com
Some people may want to generate code from the service keyword but I don't find that compelling at all.

Really what gogoprotobuf needs in order to be used as an encoding with Go's RPC system is the server and client codecs. In other words: just a library.

All of the changes to the protorpc library necessary to use gogoprotobuf with Cockroach are here: https://github.com/cockroachdb/cockroach/tree/master/rpc/codec

Walter Schulze

unread,
Nov 25, 2014, 1:16:26 PM11/25/14
to Spencer Kimball, gogopr...@googlegroups.com
I think it would be nice to keep it as a separate library.
If I get a good organisation name on github, we could move the library under the organisation, so they all live together.
How does that sound?

Spencer Kimball

unread,
Nov 25, 2014, 1:21:43 PM11/25/14
to Walter Schulze, gogopr...@googlegroups.com
Sounds fine to me.

Walter Schulze

unread,
Nov 25, 2014, 1:23:54 PM11/25/14
to Spencer Kimball, gogopr...@googlegroups.com
So to answer your original question, no it was not planned :)
Reply all
Reply to author
Forward
0 new messages