> 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? > > Klaus Ma wrote: > 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; > } > > Alexander Rukletsov wrote: > Hmmm, I see your point. I would leave this decision to your shepherd!
While `RepeatedPtrField<RepeatedPtrField<T>>` => `Array<Array<T>>` is a fine mapping in and of itself, `RepeatedPtrField<RepeatedPtrField<T>>` would not arise from a legitimate protobuf definition. In order to prevent from manually constructed instances of `RepeatedPtrField<RepeatedPtrField<T>>` being passed around, I'm for keeping the `static_assert` here. - Michael ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/38342/#review100950 ----------------------------------------------------------- On Oct. 4, 2015, 11:29 a.m., Klaus Ma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/38342/ > ----------------------------------------------------------- > > (Updated Oct. 4, 2015, 11:29 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 > >