Repository: mesos
Updated Branches:
  refs/heads/master 02758c4e7 -> 884459168


Added operators for offer operation update protobuf classes.

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


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

Branch: refs/heads/master
Commit: 06209e614c6f4a0593d017ab293bd1819acbc02b
Parents: 02758c4
Author: Gaston Kleiman <gas...@mesosphere.io>
Authored: Thu Dec 7 19:59:46 2017 -0800
Committer: Greg Mann <gregorywm...@gmail.com>
Committed: Thu Dec 7 20:41:54 2017 -0800

----------------------------------------------------------------------
 include/mesos/type_utils.hpp |  9 +++++
 src/common/type_utils.cpp    | 49 +++++++++++++++++++++++
 src/messages/messages.cpp    | 83 ++++++++++++++++++++++++++++++++++++++-
 src/messages/messages.hpp    | 15 +++++++
 4 files changed, 154 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/06209e61/include/mesos/type_utils.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp
index b786d0e..506f667 100644
--- a/include/mesos/type_utils.hpp
+++ b/include/mesos/type_utils.hpp
@@ -64,6 +64,10 @@ bool operator==(const Labels& left, const Labels& right);
 bool operator==(const MasterInfo& left, const MasterInfo& right);
 
 bool operator==(
+    const OfferOperationStatus& left,
+    const OfferOperationStatus& right);
+
+bool operator==(
     const ResourceProviderInfo& left,
     const ResourceProviderInfo& right);
 
@@ -82,6 +86,11 @@ bool operator==(const Volume& left, const Volume& right);
 bool operator!=(const CheckStatusInfo& left, const CheckStatusInfo& right);
 bool operator!=(const ExecutorInfo& left, const ExecutorInfo& right);
 bool operator!=(const Labels& left, const Labels& right);
+
+bool operator!=(
+    const OfferOperationStatus& left,
+    const OfferOperationStatus& right);
+
 bool operator!=(const TaskStatus& left, const TaskStatus& right);
 
 inline bool operator==(const ExecutorID& left, const ExecutorID& right)

http://git-wip-us.apache.org/repos/asf/mesos/blob/06209e61/src/common/type_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index 8cc987c..65586a5 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -434,6 +434,55 @@ bool operator==(
 
 
 bool operator==(
+    const OfferOperationStatus& left,
+    const OfferOperationStatus& right)
+{
+  if (left.has_operation_id() != right.has_operation_id()) {
+    return false;
+  }
+
+  if (left.has_operation_id() && left.operation_id() != right.operation_id()) {
+    return false;
+  }
+
+  if (left.state() != right.state()) {
+    return false;
+  }
+
+  if (left.has_message() != right.has_message()) {
+    return false;
+  }
+
+  if (left.has_message() && left.message() != right.message()) {
+    return false;
+  }
+
+  if (Resources(left.converted_resources()) !=
+      Resources(right.converted_resources())) {
+    return false;
+  }
+
+  if (left.has_status_uuid() != right.has_status_uuid()) {
+    return false;
+  }
+
+  if (left.has_status_uuid() && left.status_uuid() != right.status_uuid()) {
+    return false;
+  }
+
+  return true;
+}
+
+
+bool operator!=(
+    const OfferOperationStatus& left,
+    const OfferOperationStatus& right)
+{
+  return !(left == right);
+}
+
+
+bool operator==(
     const ResourceStatistics& left,
     const ResourceStatistics& right)
 {

http://git-wip-us.apache.org/repos/asf/mesos/blob/06209e61/src/messages/messages.cpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.cpp b/src/messages/messages.cpp
index 6029502..47f7dee 100644
--- a/src/messages/messages.cpp
+++ b/src/messages/messages.cpp
@@ -55,13 +55,62 @@ bool operator!=(
 }
 
 
+bool operator==(
+    const OfferOperationStatusUpdate& left,
+    const OfferOperationStatusUpdate& right)
+{
+  if (left.has_framework_id() != right.has_framework_id()) {
+    return false;
+  }
+
+  if (left.has_framework_id() && left.framework_id() != right.framework_id()) {
+    return false;
+  }
+
+  if (left.has_slave_id() != right.has_slave_id()) {
+    return false;
+  }
+
+  if (left.has_slave_id() && left.slave_id() != right.slave_id()) {
+    return false;
+  }
+
+  if (left.status() != right.status()) {
+    return false;
+  }
+
+  if (left.has_latest_status() != right.has_latest_status()) {
+    return false;
+  }
+
+  if (left.has_latest_status() &&
+      left.latest_status() != right.latest_status()) {
+    return false;
+  }
+
+  if (left.operation_uuid() != right.operation_uuid()) {
+    return false;
+  }
+
+  return true;
+}
+
+
+bool operator!=(
+    const OfferOperationStatusUpdate& left,
+    const OfferOperationStatusUpdate& right)
+{
+  return !(left == right);
+}
+
+
 ostream& operator<<(ostream& stream, const StatusUpdate& update)
 {
   stream << update.status().state();
 
   if (update.has_uuid()) {
-    stream << " (UUID: " << stringify(UUID::fromBytes(update.uuid()).get())
-           << ")";
+    stream << " (Status UUID: "
+           << stringify(UUID::fromBytes(update.uuid()).get()) << ")";
   }
 
   stream << " for task " << update.status().task_id();
@@ -75,6 +124,36 @@ ostream& operator<<(ostream& stream, const StatusUpdate& 
update)
 }
 
 
+ostream& operator<<(ostream& stream, const OfferOperationStatusUpdate& update)
+{
+  stream << update.status().state();
+
+  if (update.status().has_status_uuid()) {
+    stream << " (Status UUID: "
+           << stringify(UUID::fromBytes(update.status().status_uuid()).get())
+           << ")";
+  }
+
+  stream << " for operation UUID "
+         << stringify(UUID::fromBytes(update.operation_uuid()).get());
+
+  if (update.status().has_operation_id()) {
+    stream << " (framework-supplied ID '" << update.status().operation_id()
+           << "')";
+  }
+
+  if (update.has_framework_id()) {
+    stream << " of framework '" << update.framework_id() << "'";
+  }
+
+  if (update.has_slave_id()) {
+    stream << " on agent " << update.slave_id();
+  }
+
+  return stream;
+}
+
+
 ostream& operator<<(ostream& stream, const StatusUpdateRecord::Type& type)
 {
   return stream

http://git-wip-us.apache.org/repos/asf/mesos/blob/06209e61/src/messages/messages.hpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.hpp b/src/messages/messages.hpp
index 2756eba..60b1065 100644
--- a/src/messages/messages.hpp
+++ b/src/messages/messages.hpp
@@ -45,11 +45,26 @@ bool operator!=(
     const ResourceVersionUUID& right);
 
 
+bool operator==(
+    const OfferOperationStatusUpdate& left,
+    const OfferOperationStatusUpdate& right);
+
+
+bool operator!=(
+    const OfferOperationStatusUpdate& left,
+    const OfferOperationStatusUpdate& right);
+
+
 std::ostream& operator<<(std::ostream& stream, const StatusUpdate& update);
 
 
 std::ostream& operator<<(
     std::ostream& stream,
+    const OfferOperationStatusUpdate& update);
+
+
+std::ostream& operator<<(
+    std::ostream& stream,
     const StatusUpdateRecord::Type& type);
 
 } // namespace internal {

Reply via email to