You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2017/11/08 16:01:29 UTC

[8/9] mesos git commit: Added comparison operators for 'ResourceVersionUUID'.

Added comparison operators for 'ResourceVersionUUID'.

See summary.

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


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

Branch: refs/heads/master
Commit: 06856ecadf30852563ad427474aed02aae2792d9
Parents: f44cc22
Author: Benjamin Bannier <bb...@apache.org>
Authored: Wed Nov 8 00:52:30 2017 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Wed Nov 8 15:51:20 2017 +0100

----------------------------------------------------------------------
 src/messages/messages.cpp | 29 +++++++++++++++++++++++++++++
 src/messages/messages.hpp | 10 ++++++++++
 2 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/06856eca/src/messages/messages.cpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.cpp b/src/messages/messages.cpp
index 7f1da63..6029502 100644
--- a/src/messages/messages.cpp
+++ b/src/messages/messages.cpp
@@ -26,6 +26,35 @@ using std::ostream;
 namespace mesos {
 namespace internal {
 
+bool operator==(
+    const ResourceVersionUUID& left,
+    const ResourceVersionUUID& right)
+{
+  if (left.has_resource_provider_id() != right.has_resource_provider_id()) {
+    return false;
+  }
+
+  if (left.has_resource_provider_id() &&
+      left.resource_provider_id() != right.resource_provider_id()) {
+    return false;
+  }
+
+  if (left.uuid() != right.uuid()) {
+    return false;
+  }
+
+  return true;
+}
+
+
+bool operator!=(
+    const ResourceVersionUUID& left,
+    const ResourceVersionUUID& right)
+{
+  return !(left == right);
+}
+
+
 ostream& operator<<(ostream& stream, const StatusUpdate& update)
 {
   stream << update.status().state();

http://git-wip-us.apache.org/repos/asf/mesos/blob/06856eca/src/messages/messages.hpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.hpp b/src/messages/messages.hpp
index 0a2a947..2756eba 100644
--- a/src/messages/messages.hpp
+++ b/src/messages/messages.hpp
@@ -35,6 +35,16 @@
 namespace mesos {
 namespace internal {
 
+bool operator==(
+    const ResourceVersionUUID& left,
+    const ResourceVersionUUID& right);
+
+
+bool operator!=(
+    const ResourceVersionUUID& left,
+    const ResourceVersionUUID& right);
+
+
 std::ostream& operator<<(std::ostream& stream, const StatusUpdate& update);