mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chun-Hung Hsiao <chhs...@mesosphere.io>
Subject Re: Review Request 59987: Added protobuf map support.
Date Thu, 08 Feb 2018 20:16:04 GMT


> On Sept. 22, 2017, 11:14 p.m., Chun-Hung Hsiao wrote:
> > 3rdparty/stout/include/stout/protobuf.hpp
> > Line 607 (original), 640 (patched)
> > <https://reviews.apache.org/r/59987/diff/2/?file=1768786#file1768786line640>
> >
> >     How about a partial specialization for `google::protobuf::Map`?
> 
> Qian Zhang wrote:
>     Why do we need to do that? What do we want to achieve with such a partial specialization?
> 
> Chun-Hung Hsiao wrote:
>     For providing the `parse<google::protobuf::Map<K, V>>(const JSON::Value&
value)` function. Say if we want to create a protobuf message `m` that contains a `map<string,
string> map_field`, we cannot just do `m.mutable_map_field()->CopyFrom(parse<google::protobuf::RepeatedPtrField<...>(json))`.
Instead we probably need something like `m.mutable_map_field()->swap(parse<google::protobuf::Map(json))`.
> 
> Chun-Hung Hsiao wrote:
>     Oh we probably cannot just apply `swap` on an r-value. But you know want I mean ;)
> 
> Qian Zhang wrote:
>     So you mean just like the partial specialization for `google::protobuf::RepeatedPtrField`:
>     ```
>     template <typename T>
>     struct Parse<google::protobuf::RepeatedPtrField<T>>
>     ```
>     We can add a partial specialization for `google::protobuf::Map`, right? I see there
are a lot of places in our code to call the partial specialization for `google::protobuf::RepeatedPtrField`,
but I am not sure if we have a need to call the partial specialization for `google::protobuf::Map`
in our code.

Consider stout can be standalone it would be nice to have it for completeness. But let's do
it later when needed. Dropping this issue for now.


- Chun-Hung


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


On Dec. 21, 2017, 2:07 a.m., Qian Zhang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59987/
> -----------------------------------------------------------
> 
> (Updated Dec. 21, 2017, 2:07 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Chun-Hung Hsiao, and Zhitao Li.
> 
> 
> Bugs: MESOS-7656
>     https://issues.apache.org/jira/browse/MESOS-7656
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Map is a feature of proto2 syntax, but it can only be compiled
> with proto3 compiler, see the following discussion for details:
> https://groups.google.com/forum/#!topic/protobuf/p4WxcplrlA4
> We have already upgraded the compiler from 2.6.1 to 3.3.0 in
> MESOS-7228, however, to use protobuf map in Mesos code, we also
> need to add the protobuf map support to the code in Mesos for
> converting protobuf message to JSON object and parsing JSON
> object as protobuf message, that is what I have done in this patch.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/protobuf.hpp baad12648dd78ab72ea4277f4c7f99da16696a40

> 
> 
> Diff: https://reviews.apache.org/r/59987/diff/4/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>


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