Could it be possible to specify id's for methods

9 views
Skip to first unread message

fre...@gmail.com

unread,
Jul 19, 2008, 8:06:08 AM7/19/08
to Protocol Buffers
In my RPC implementation services are backwards compatible as long as
the method has the same id. Unfortunatly i could not find a way to
specify the id of a metod in a .proto-file in the same way that it is
with messages. Is there such a way which i couldn't find?

If i implement a patch a with backwards compatible way to specify the
id's of a method, would you be interested to include that in the
protocol buffers distribution, or are there any reasons for having
id's on fields in messages, but not on methods in services?

A proto file with services with id's would look like this:
service Exprintserver {
rpc set_config (Exprintconfig) returns
(ExprintserverSetConfigResponse)=1;
// rpc reset_config () returns (Exprintconfig)=2; // not used
anymore
rpc get_config () returns (Exprintconfig)=3;
};

Marc Gravell

unread,
Jul 19, 2008, 9:33:16 AM7/19/08
to Protocol Buffers
Agree it feels like an omission. In my thoughts on RPC I was guessing
at having to use the string as a header for the dispatcher.

Marc

Marc Gravell

unread,
Jul 19, 2008, 5:41:46 PM7/19/08
to Protocol Buffers
I just had an epiphany. Simply: it doesn't matter. You only send one
method name per message; it isn't part of the payload so there is no
incremental cost. Compared to the round-trip latency between messages
it is completly a non-issue. So actually, I'd have to say that it
isn't going to make any practical difference whether you describe a
method as "SaveCustomer" or "7".

So as a consequence I'd have to say keep it as is, and dispatch by
name.

That's my thought, anyway...

Marc

Kenton Varda

unread,
Jul 19, 2008, 10:24:15 PM7/19/08
to fre...@gmail.com, Protocol Buffers
We chose to identify methods by name rather than number, because sending a string name once per RPC seemed like an acceptable level of overhead.  Fields of a message are identified by number because having a string for every field would not be acceptable.  So, just send the method name.
Reply all
Reply to author
Forward
0 new messages