You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2015/12/03 00:54:38 UTC
mesos git commit: Addressed a TODO in `resources.cpp`.
Repository: mesos
Updated Branches:
refs/heads/master 80c45177d -> 0a82c2b12
Addressed a TODO in `resources.cpp`.
Review: https://reviews.apache.org/r/40788
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0a82c2b1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0a82c2b1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0a82c2b1
Branch: refs/heads/master
Commit: 0a82c2b12123ea6099bc169b1eb567b0f5ab473f
Parents: 80c4517
Author: Greg Mann <gr...@mesosphere.io>
Authored: Wed Dec 2 18:33:10 2015 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Wed Dec 2 18:54:19 2015 -0500
----------------------------------------------------------------------
src/common/resources.cpp | 7 +------
src/v1/resources.cpp | 7 +------
2 files changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0a82c2b1/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 0a65748..5a79817 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -804,10 +804,6 @@ Resources Resources::flatten(
}
-// A predicate that returns true for any resource.
-static bool any(const Resource&) { return true; }
-
-
Option<Resources> Resources::find(const Resources& targets) const
{
Resources total;
@@ -1156,11 +1152,10 @@ Option<Resources> Resources::find(const Resource& target) const
Resources remaining = Resources(target).flatten();
// First look in the target role, then unreserved, then any remaining role.
- // TODO(mpark): Use a lambda for 'any' instead once we get full C++11.
vector<lambda::function<bool(const Resource&)>> predicates = {
lambda::bind(isReserved, lambda::_1, target.role()),
isUnreserved,
- any
+ [](const Resource&) { return true; }
};
foreach (const auto& predicate, predicates) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0a82c2b1/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index 90830c9..d300842 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -799,10 +799,6 @@ Resources Resources::flatten(
}
-// A predicate that returns true for any resource.
-static bool any(const Resource&) { return true; }
-
-
Option<Resources> Resources::find(const Resources& targets) const
{
Resources total;
@@ -1141,11 +1137,10 @@ Option<Resources> Resources::find(const Resource& target) const
Resources remaining = Resources(target).flatten();
// First look in the target role, then unreserved, then any remaining role.
- // TODO(mpark): Use a lambda for 'any' instead once we get full C++11.
vector<lambda::function<bool(const Resource&)>> predicates = {
lambda::bind(isReserved, lambda::_1, target.role()),
isUnreserved,
- any
+ [](const Resource&) { return true; }
};
foreach (const auto& predicate, predicates) {