> On Sept. 20, 2016, 10 a.m., Jiang Yan Xu wrote:
> > include/mesos/resources.hpp, lines 60-64
> > <https://reviews.apache.org/r/51999/diff/2/?file=1504205#file1504205line60>
> >
> >     We can get rid of this forward declaration if we can get rid of the 
> > internal convertJSON.
> 
> Anindya Sinha wrote:
>     Based on the refactor, we are keeping `convertJSON()`.

Why are we keeping `convertJSON()`?

`convertJSON` was orginally a private helper, now we are making it public 
because it's useful externally. Now that it's made public, keeping a separate 
`convertJSON()` with a single caller `fromJSONString()` feels redundant. It's 
basically the same thing except that `convertJSON()`, as a friend of Resources, 
can access the private `add()` method but now `fromJSONString/convertJSON` 
doesn't even rely on it anymore (it returns a vector). Even the need for access 
to `add()` in `Resources::parse(text, defaultRole)` is not obvious due to where 
it is typically called from.

As a result, can we kill it?


- Jiang Yan


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


On Sept. 26, 2016, 1:58 p.m., Anindya Sinha wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/51999/
> -----------------------------------------------------------
> 
> (Updated Sept. 26, 2016, 1:58 p.m.)
> 
> 
> Review request for mesos and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-6062
>     https://issues.apache.org/jira/browse/MESOS-6062
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Refactored `Resources::parse()` into 2 separate static functions:
> 1. Resources::fromJSONString() to parse JSON representation of
>    resources.
> 2. Resources::fromSimpleString() to parse text representation of
>    resources.
> 
> Since these 2 new functions return a `Try<vector<Resource>>`, the
> existing `Resources::parse()` implicitly converts that to a
> `Resources` object. This refactor is done to retrieve all resources
> (include empty resources) required for auto detection of root
> and MOUNT disks.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp 3ef8cacee529addc745b4aeb6398d7606c61b749 
>   include/mesos/v1/resources.hpp ef56b4960b103a3efd916fab64796aa334ba44c6 
>   src/common/resources.cpp 0774ff0669e831494d5b12b88e19dfa0a4a3f757 
>   src/tests/resources_tests.cpp 3e493007d6d1d8194d07035aaa1cde28dedf2b5a 
>   src/v1/resources.cpp 62a644ebbd13cfc0862bd118ba16c43e0f6aaf90 
> 
> Diff: https://reviews.apache.org/r/51999/diff/
> 
> 
> Testing
> -------
> 
> All tests passed.
> 
> 
> Thanks,
> 
> Anindya Sinha
> 
>

Reply via email to