[
https://issues.apache.org/jira/browse/MESOS-4447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15172278#comment-15172278
]
Benjamin Mahler commented on MESOS-4447:
----------------------------------------
Hm.. I can't tell why we're doing this change:
https://reviews.apache.org/r/42590/diff/3#1
If I remember correctly, we have these two overloads because the return types
are different. For the first function {{hashmap<string, Resources>
reserved()}}, we want to obtain a mapping of the reserved resources, indexed by
the role. The second function {{Resources reserved(string role)}} is equivalent
to an entry in the map returned by the first function. What are the issues with
these and why are you trying to consolidate them?
> Updated reserved() API
> ----------------------
>
> Key: MESOS-4447
> URL: https://issues.apache.org/jira/browse/MESOS-4447
> Project: Mesos
> Issue Type: Bug
> Reporter: Guangya Liu
> Assignee: Guangya Liu
>
> There are some problems for current {{reserve}} API. The problem is as
> following:
> {code}
> hashmap<string, Resources> Resources::reserved() const
> {
> hashmap<string, Resources> result;
> foreach (const Resource& resource, resources) {
> if (isReserved(resource)) {
> result[resource.role()] += resource;
> }
> }
> return result;
> }
> Resources Resources::reserved(const string& role) const
> {
> return filter(lambda::bind(isReserved, lambda::_1, role));
> }
> bool Resources::isReserved(
> const Resource& resource,
> const Option<string>& role)
> {
> if (role.isSome()) {
> return !isUnreserved(resource) && role.get() == resource.role();
> } else {
> return !isUnreserved(resource);
> }
> }
> {code}
> This caused the {{reserved(const string& role) }} has no chance to transfer a
> None() parameter to get all reserved resources in flatten mode.
> The solution is remove {{reserved()}} and update {{reserved(const string&
> role) }} to {{reserved(const Option<string>& role = None()) }}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)