> On March 23, 2015, 5:44 p.m., Alexander Rojas wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp, lines 
> > 588-603
> > <https://reviews.apache.org/r/32105/diff/4/?file=897000#file897000line588>
> >
> >     As I see you create the body of a json object where all the elements 
> > are strings themselves, ignoring their actual types and in 
> > [30931](https://reviews.apache.org/r/30931/diff/) the outer brackets are 
> > added completing the json object.
> >     
> >     In the endpoints, for example 
> > [here](https://github.com/apache/mesos/blob/0c7104d4d83d28371db7d19dcbb1bf077eeede05/src/master/http.cpp#L108)
> >  we use a patter for serialisation where we create a json object through a 
> > `model` function, and then we serialise the resulting json.
> >     
> >     Is there a reason why that approach wouln't work here?

In the rest of stout we use the operator >> version for printing stuff. I in 
general like the idea of a general model function, but it also looks slightly 
less intuitive when printing the flags to the log (see code below).
For this patch I refere the operator solution for consistency with the rest of 
stout.

flags.hpp
    inline JSON::Object model(const FlagsBase& _flags)
    {
     JSON::Object flags;
     foreachvalue (const flags::Flag& flag, _flags) {
        const Option<std::string>& value = flag.stringify(_flags);
        if (value.isSome()) {
           flags.values[flag.name] = value.get();
       }
     }
     return flags;
    }

slave/master
    LOG(INFO) << "Flags at startup: {" << flags::model(flags) << "}";


- Joerg


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


On March 17, 2015, 12:25 a.m., Joerg Schad wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32105/
> -----------------------------------------------------------
> 
> (Updated March 17, 2015, 12:25 a.m.)
> 
> 
> Review request for mesos.
> 
> 
> Bugs: Mesos-2323
>     https://issues.apache.org/jira/browse/Mesos-2323
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> see summary
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp 
> aedb6ab30d929b81f55270612e76009bd7850daa 
> 
> Diff: https://reviews.apache.org/r/32105/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Joerg Schad
> 
>

Reply via email to