Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase >> mail # dev >> Use of required keyword in protobuf messages

Chris Trezzo 2012-08-06, 22:39
Jimmy Xiang 2012-08-06, 22:54
Stack 2012-08-07, 07:47
Copy link to this message
Re: Use of required keyword in protobuf messages
On Tue, Aug 7, 2012 at 12:47 AM, Stack <[EMAIL PROTECTED]> wrote:

> On Mon, Aug 6, 2012 at 11:39 PM, Chris Trezzo <[EMAIL PROTECTED]> wrote:
> > Some engineers at Google have come to the conclusion that using
> > requireddoes more harm than good; they prefer to use only
> > optional and repeated. However, this view is not universal."
> >
> > Thoughts?
> >
> How hard adding the logic Chris?  Any 'costs' associated.
> St.Ack

I've found (in my limited experience) that it ends up being a single
helper/util function per message, though at worst it can be one helper per
element in the message. The latter comes about if you have an optional
element that also has some optional elements. In that case you need to make
sure that (1) the message content there and (2) enough of the content is

Fortunately, this is usually a pretty fast check, just checking the
presence of fields per RPC (and each object has generated has___() methods
for this checking), so its not too terrible since the boolean checks are
pretty fast (and using generalized RPC already has a bunch of overhead too

This can theoretically lead to a proliferation of helper functions that
validate message/message contents for lots of different cases. In reality
though, I think this ends up being at most 2-3 per message type (at
_worst_) given then relative simplicity of our RPCs. If we go with this, we
will probably have to a have a helper/validator cleanup when its gets out
of control.

Jesse Yates
Andrew Purtell 2012-08-07, 16:09
Devaraj Das 2012-08-07, 18:39
Gregory Chanan 2012-08-07, 20:33
lars hofhansl 2012-08-08, 00:23
Gregory Chanan 2012-08-08, 19:39
Todd Lipcon 2012-08-08, 19:46