Repository: mesos
Updated Branches:
  refs/heads/master b0d4439d6 -> 9afaaffd8


Added utils method to check if `ExecutorInfo` different.

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


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

Branch: refs/heads/master
Commit: ebe7ea56fa0f00e63a3fd274eaad75b58985b075
Parents: b0d4439
Author: haosdent huang <haosd...@gmail.com>
Authored: Fri Oct 14 11:59:26 2016 -0700
Committer: Vinod Kone <vinodk...@gmail.com>
Committed: Fri Oct 14 11:59:26 2016 -0700

----------------------------------------------------------------------
 include/mesos/type_utils.hpp |  1 +
 src/common/type_utils.cpp    | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ebe7ea56/include/mesos/type_utils.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp
index 1d09b4f..88c7bcf 100644
--- a/include/mesos/type_utils.hpp
+++ b/include/mesos/type_utils.hpp
@@ -68,6 +68,7 @@ bool operator==(const TaskStatus& left, const TaskStatus& 
right);
 bool operator==(const URL& left, const URL& right);
 bool operator==(const Volume& left, const Volume& right);
 
+bool operator!=(const ExecutorInfo& left, const ExecutorInfo& right);
 bool operator!=(const Labels& left, const Labels& right);
 bool operator!=(const TaskStatus& left, const TaskStatus& right);
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/ebe7ea56/src/common/type_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index cad243f..c6cf4f1 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -318,7 +318,14 @@ bool operator==(const DiscoveryInfo& left, const 
DiscoveryInfo& right)
 
 bool operator==(const ExecutorInfo& left, const ExecutorInfo& right)
 {
-  return left.executor_id() == right.executor_id() &&
+  if (left.has_type() && right.has_type()) {
+    if (left.type() != right.type()) {
+      return false;
+    }
+  }
+
+  return left.has_type() == right.has_type() &&
+    left.executor_id() == right.executor_id() &&
     left.data() == right.data() &&
     Resources(left.resources()) == Resources(right.resources()) &&
     left.command() == right.command() &&
@@ -330,6 +337,12 @@ bool operator==(const ExecutorInfo& left, const 
ExecutorInfo& right)
 }
 
 
+bool operator!=(const ExecutorInfo& left, const ExecutorInfo& right)
+{
+  return !(left == right);
+}
+
+
 bool operator==(const MasterInfo& left, const MasterInfo& right)
 {
   return left.id() == right.id() &&

Reply via email to