mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomasz Janiszewski <jani...@gmail.com>
Subject Re: Review Request 50851: Decode Protobuf long int form strings.
Date Thu, 11 Aug 2016 08:48:09 GMT


> On Aug. 10, 2016, 11:53 p.m., Joseph Wu wrote:
> > 3rdparty/stout/include/stout/protobuf.hpp, lines 443-459
> > <https://reviews.apache.org/r/50851/diff/1/?file=1464266#file1464266line443>
> >
> >     I wonder how far we want to follow the protobuf mapping recommendations.  Technically,
protobuf3 takes strings for all types of numbers :)
> >     
> >     I'm fine with just large numbers however.

int32, fixed32, uint32 should be stored as a numbers. With float and double there is exception
for "NaN" and "Infinity"


> On Aug. 10, 2016, 11:53 p.m., Joseph Wu wrote:
> > 3rdparty/stout/include/stout/protobuf.hpp, line 447
> > <https://reviews.apache.org/r/50851/diff/1/?file=1464266#file1464266line447>
> >
> >     Unfortunately, `std::stoll` and similar functions will throw exceptions if they
fail.  And Mesos does not use exceptions.
> >     
> >     You'll need to parse the string some other way (i.e. `strtoimax`) and return
an `Error` if the parsing fails.

Good catch. I used `numify`.


> On Aug. 10, 2016, 11:53 p.m., Joseph Wu wrote:
> > 3rdparty/stout/tests/protobuf_tests.cpp, lines 334-336
> > <https://reviews.apache.org/r/50851/diff/1/?file=1464267#file1464267line334>
> >
> >     This should be checking for equality, rather than parse success:
> >     
> >     EXPECT_SOME_EQ(<some JSON object>, json);

In this test I'm not interested in checking if String to JSON works. It's only used to generate
JSON that will be parsed into message.


> On Aug. 10, 2016, 11:53 p.m., Joseph Wu wrote:
> > 3rdparty/stout/tests/protobuf_tests.cpp, lines 342-343
> > <https://reviews.apache.org/r/50851/diff/1/?file=1464267#file1464267line342>
> >
> >     This is actually a Protobuf -> JSON -> String conversion.
> >     
> >     You'll want to split these two apart and have one comparision for each step.

I changed it to compare against `Message` object. But since there is no equal method for protobuf
object I serialise them to JSON.


- Tomasz


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


On Aug. 11, 2016, 8:47 a.m., Tomasz Janiszewski wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50851/
> -----------------------------------------------------------
> 
> (Updated Aug. 11, 2016, 8:47 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Joseph Wu.
> 
> 
> Bugs: MESOS-5995
>     https://issues.apache.org/jira/browse/MESOS-5995
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> According to Protobuf JSON mapping long integers
> should be stored as strings.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/protobuf.hpp 91305e104c01d649bd435a27b159540222236c27

>   3rdparty/stout/tests/protobuf_tests.cpp 8877e8934e0f7875bfedcfa88b491ce4b13ca44f 
> 
> Diff: https://reviews.apache.org/r/50851/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Tomasz Janiszewski
> 
>


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