You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2017/02/01 20:26:30 UTC

mesos git commit: Simplified AppC provisioner cache keys comparison.

Repository: mesos
Updated Branches:
  refs/heads/master cb671fa7b -> ab0a6b5b9


Simplified AppC provisioner cache keys comparison.

Manual elements searching is not required since `std::map`
is ordered. Replaced it with standard `operator==` that
checks maps sizes and does linear element by element
comparison.

Review: https://reviews.apache.org/r/56086/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ab0a6b5b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ab0a6b5b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ab0a6b5b

Branch: refs/heads/master
Commit: ab0a6b5b925afebe867763cfb260fa5e06fdf4c1
Parents: cb671fa
Author: Ilya Pronin <ip...@twopensource.com>
Authored: Wed Feb 1 12:25:41 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Wed Feb 1 12:25:41 2017 -0800

----------------------------------------------------------------------
 .../containerizer/mesos/provisioner/appc/cache.cpp    | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ab0a6b5b/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/appc/cache.cpp b/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
index 8584e59..09190e2 100644
--- a/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
+++ b/src/slave/containerizer/mesos/provisioner/appc/cache.cpp
@@ -146,18 +146,8 @@ bool Cache::Key::operator==(const Cache::Key& other) const
     return false;
   }
 
-  foreachpair (const string& name, const string& value, other.labels) {
-    map<string, string>::const_iterator itr = labels.find(name);
-    if ((itr == labels.end()) || (labels.at(name) != value)) {
-      return false;
-    }
-  }
-
-  foreachpair (const string& name, const string& value, labels) {
-    map<string, string>::const_iterator itr = other.labels.find(name);
-    if ((itr == other.labels.end()) || (other.labels.at(name) != value)) {
-      return false;
-    }
+  if (labels != other.labels) {
+    return false;
   }
 
   return true;