[
https://issues.apache.org/jira/browse/MESOS-4447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15173241#comment-15173241
]
Guangya Liu commented on MESOS-4447:
------------------------------------
[~bmahler] The reason that I want to remove this API is because:
1) The API {{Resources Resources::reserved(const string& role) const}} should
able to return reserved resources for a specified role or all reserved
resources for all roles in flatten mode, the {{Optimistic Offer Phase 1}}
highly depends on the API of flatten reserved resources for different roles as
I need to translate those resources to allocation slack. Here I was removing
the API of {{reserved()}} and enable {{Resources Resources::reserved(const
string& role) const}} can work without role specified.
2) If removed the API of {{reserved()}}, then the one who is calling
{{reserved()}} before can get the reserved resources for different roles first
and then create a hashmap in the caller. Currently there are only two places
calling the {{reserved()}} API.
> 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)