Rename reserved() to reservations() in resources.cpp

8 views
Skip to first unread message

Guangya Liu

unread,
Mar 11, 2016, 9:48:45 PM3/11/16
to Mesos Resource Allocation Working Group
Hi,

Currently, there are two APIs related to reservations in resources.cpp as following:

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));

}


The first resrved() API will return a hashmap of reserved resource with role as key and resources as value.

The second reserved(const string& role)  will only return reserved resources for a specified role, but this is not the intention of the API, as this API actually want to return either reserved resources for a specified role or all reserved resources in mesos cluster for all roles in flatten mode.


So we need to update the API of reserved(const string& role) to reserved(const Option<string>& role) with default value as None():


Resources Resources::reserved(const Option<string>& role) const

{

  return filter(lambda::bind(isReserved, lambda::_1, role));

}


But the problem is that if the caller use "reserved()", the compiler will not know which "reserved()" API does the caller is using, after some discussion with BMahler, MPark, Josep, we want to rename the API of "reserved()" to "reservation()" to resolve this conflict.


I have uploaded a patch here https://reviews.apache.org/r/42590 and please show your comments if any. 


Thanks,


Guangya


Benjamin Mahler

unread,
Mar 11, 2016, 10:21:49 PM3/11/16
to Guangya Liu, Mesos Resource Allocation Working Group
Thanks, I'll get this committed shortly.

--
You received this message because you are subscribed to the Google Groups "Mesos Resource Allocation Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mesos-allocati...@googlegroups.com.
To post to this group, send email to mesos-al...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mesos-allocation/4af09f6a-6301-417f-8f8e-a8c3b9286c37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benjamin Mahler

unread,
Mar 11, 2016, 10:25:52 PM3/11/16
to Guangya Liu, Mesos Resource Allocation Working Group
Committed. I wasn't able to resolve your ticket, JIRA appears to be unresponsive.

Guangya Liu

unread,
Mar 11, 2016, 10:43:19 PM3/11/16
to Mesos Resource Allocation Working Group, gyli...@gmail.com
Thanks Ben, have a nice weekend ;-)

在 2016年3月12日星期六 UTC+8上午11:25:52,Benjamin Mahler写道:
To unsubscribe from this group and stop receiving emails from it, send an email to mesos-allocation+unsubscribe@googlegroups.com.
To post to this group, send email to mesos-allocation@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages