mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klaus Ma" <kl...@cguru.net>
Subject Re: Review Request 38342: Add JSON::protobuf for google::protobuf::RepeatedPtrField (stout part)
Date Wed, 30 Sep 2015 01:45:23 GMT


> On Sept. 29, 2015, 10:43 a.m., Alexander Rukletsov wrote:
> > 3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.h, line 40
> > <https://reviews.apache.org/r/38342/diff/4/?file=1085229#file1085229line40>
> >
> >     Just to confirm: this file is generated using bundled protobuf, right? Could
you please put the `protoc` version in the RR description for posterity?

Yes, I used `protoc` built from our source code.


> On Sept. 29, 2015, 10:43 a.m., Alexander Rukletsov wrote:
> > 3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.proto, line 80
> > <https://reviews.apache.org/r/38342/diff/4/?file=1085231#file1085231line80>
> >
> >     s/MessageArray/ArrayMessage
> >     
> >     A high level question: why wouldn't you use `SimpleMessage` instead? Proto->JSON
conversion for a single message is already checked in the different test, you want to check
the conversion for collections. I would say, using `SimpleMessage` can reduce the amount of
test code needed.

Agree, it'll reduce the LOC (line of code).


> On Sept. 29, 2015, 10:43 a.m., Alexander Rukletsov wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp, lines 773-774
> > <https://reviews.apache.org/r/38342/diff/4/?file=1085227#file1085227line773>
> >
> >     Could you please help me understand why this check is necessary? IIUC, compiler
ensures `T` is a protobuf becasue you pass `elem` of type `T` to `JSON::protobuf()`.
> >     
> >     AFAIK, the only reason to do this check is to prohibit arguments like `google::protobuf::RepeatedPtrField<google::protobuf::RepeatedPtrField<T>>`.
Do you want to express this? I don't think it is necessary, because `JSON::Array` filled with
`JSON::Array` is fine.
> >     
> >     @MPark, what'd you say?

To me, this's a safe guard to make sure this function is not abused.
For `google::protobuf::RepeatedPtrField<google::protobuf::RepeatedPtrField<T>>`,
I think we need to define a message to include `google::protobuf::RepeatedPtrField<T>`,
the proto file looks like:

    message MyMessage
    {
        message Item {
            string value = 1;
        }
        repeated Item values = 1;
    }


- Klaus


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38342/#review100950
-----------------------------------------------------------


On Sept. 27, 2015, 1:34 a.m., Klaus Ma wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38342/
> -----------------------------------------------------------
> 
> (Updated Sept. 27, 2015, 1:34 a.m.)
> 
> 
> Review request for mesos, Alexander Rukletsov, Michael Park, and Jan Schlicht.
> 
> 
> Bugs: MESOS-3405
>     https://issues.apache.org/jira/browse/MESOS-3405
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently, `stout/protobuf.hpp` provides a `JSON::Protobuf` utility which converts a
`google::protobuf::Message` into a `JSON::Object`.
> We should add the support for `google::protobuf::RepeatedPtrField<T>` by introducing
overloaded functions.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp 2285ce9 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp 68328a2 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.h 8ebb798 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc 34eb6d0 
>   3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.proto 920f5c9 
> 
> Diff: https://reviews.apache.org/r/38342/diff/
> 
> 
> Testing
> -------
> 
> cd 3rdparty/libprocess/3rdparty/stout
> ./boostrap
> ./configure
> make
> 
> 
> Thanks,
> 
> Klaus Ma
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message