> On 一月 7, 2016, 12:31 a.m., Joseph Wu wrote:
> > src/common/resources.cpp, lines 880-891
> > <https://reviews.apache.org/r/41772/diff/2/?file=1180306#file1180306line880>
> >
> > Does this give you more value than something like this?
> > ```
> > resources.filter(isReserved).flatten()
> > ```
The reason that I want to add this helper is because I do not want to use
"resources.filter(isReserved).flatten()" every time when I want to get flatten
reserved, as it is a bit longer.
So what about following?
Resources Resources::reserved_() const
{
return resources.filter(isReserved).flatten();
}
This can make the caller get flatten resrved with only one call.
> On 一月 7, 2016, 12:31 a.m., Joseph Wu wrote:
> > src/common/resources.cpp, lines 894-904
> > <https://reviews.apache.org/r/41772/diff/2/?file=1180306#file1180306line894>
> >
> > This seems more appropriate as an optional parameter for
> > `Resources::flatten`, just like `Option<Resource::ReservationInfo>`.
My original thinking was adding an optional parameter to flatten(), the reason
that I did not do that is because every time I want to set ALLOCATION_SLACK or
USAGE_SLACK for a resource, I need to put all paramters, it is a long sentence,
so I just add this new helper.
The caller need to call {flatten("*", None(),
Resource::RevocableInfo::ALLOCATION_SLACK);} if want to set a resources as
allocation slack.
- Guangya
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41772/#review113153
-----------------------------------------------------------
On 一月 3, 2016, 9:42 a.m., Guangya Liu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41772/
> -----------------------------------------------------------
>
> (Updated 一月 3, 2016, 9:42 a.m.)
>
>
> Review request for mesos, Ben Mahler, Artem Harutyunyan, Joris Van
> Remoortere, Joseph Wu, and Klaus Ma.
>
>
> Bugs: MESOS-4267
> https://issues.apache.org/jira/browse/MESOS-4267
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Added two new helper functions to flatten resources.
> 1) Flatten reserved resources.
> 2) Flatten allocation slack revocable resources.
>
>
> Diffs
> -----
>
> include/mesos/resources.hpp 9c8bfb0e7e1e40ca99b4cc75079e5b950630243d
> include/mesos/v1/resources.hpp db87c992e2ec466cb1d4d17775bf6423a2fb15aa
> src/common/resources.cpp b9d31aef8babee212374e352c57fadbff02167f3
> src/tests/resources_tests.cpp e4a3435adc14f3b6b278b32348a6991543d5a320
> src/v1/resources.cpp 0c0eee6b3b7ae3254d7dc7b06187855c9b873764
>
> Diff: https://reviews.apache.org/r/41772/diff/
>
>
> Testing
> -------
>
> make
> make check
>
>
> Thanks,
>
> Guangya Liu
>
>