Repository: mesos Updated Branches: refs/heads/master 2c6952694 -> 8c9184a03
Added comparison operators for operations. Review: https://reviews.apache.org/r/65671/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ddecf8ee Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ddecf8ee Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ddecf8ee Branch: refs/heads/master Commit: ddecf8ee6f75ce631c5e91c49220eed12d600910 Parents: 2c69526 Author: Jan Schlicht <j...@mesosphere.io> Authored: Mon Feb 19 15:15:35 2018 +0100 Committer: Benjamin Bannier <bbann...@apache.org> Committed: Mon Feb 19 15:15:35 2018 +0100 ---------------------------------------------------------------------- include/mesos/type_utils.hpp | 2 ++ include/mesos/v1/mesos.hpp | 2 ++ src/common/type_utils.cpp | 14 ++++++++++++++ src/v1/mesos.cpp | 14 ++++++++++++++ 4 files changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ddecf8ee/include/mesos/type_utils.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp index af2b187..2fff71f 100644 --- a/include/mesos/type_utils.hpp +++ b/include/mesos/type_utils.hpp @@ -62,6 +62,7 @@ bool operator==(const ExecutorInfo& left, const ExecutorInfo& right); bool operator==(const Label& left, const Label& right); bool operator==(const Labels& left, const Labels& right); bool operator==(const MasterInfo& left, const MasterInfo& right); +bool operator==(const Offer::Operation& left, const Offer::Operation& right); bool operator==(const OperationStatus& left, const OperationStatus& right); bool operator==( @@ -84,6 +85,7 @@ 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 Offer::Operation& left, const Offer::Operation& right); bool operator!=(const OperationStatus& left, const OperationStatus& right); bool operator!=(const TaskStatus& left, const TaskStatus& right); http://git-wip-us.apache.org/repos/asf/mesos/blob/ddecf8ee/include/mesos/v1/mesos.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/mesos.hpp b/include/mesos/v1/mesos.hpp index f16568e..04b8fd5 100644 --- a/include/mesos/v1/mesos.hpp +++ b/include/mesos/v1/mesos.hpp @@ -60,6 +60,7 @@ bool operator==(const FileInfo& left, const FileInfo& right); bool operator==(const Label& left, const Label& right); bool operator==(const Labels& left, const Labels& right); bool operator==(const MasterInfo& left, const MasterInfo& right); +bool operator==(const Offer::Operation& left, const Offer::Operation& right); bool operator==( const ResourceProviderInfo& left, @@ -75,6 +76,7 @@ bool operator==(const URL& left, const URL& right); bool operator==(const Volume& left, const Volume& right); bool operator!=(const Labels& left, const Labels& right); +bool operator!=(const Offer::Operation& left, const Offer::Operation& right); bool operator!=(const TaskStatus& left, const TaskStatus& right); http://git-wip-us.apache.org/repos/asf/mesos/blob/ddecf8ee/src/common/type_utils.cpp ---------------------------------------------------------------------- diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp index a4d5dcb..3c2711b 100644 --- a/src/common/type_utils.cpp +++ b/src/common/type_utils.cpp @@ -16,6 +16,8 @@ #include <ostream> +#include <google/protobuf/util/message_differencer.h> + #include <mesos/attributes.hpp> #include <mesos/mesos.hpp> #include <mesos/resources.hpp> @@ -439,6 +441,12 @@ bool operator==( } +bool operator==(const Offer::Operation& left, const Offer::Operation& right) +{ + return google::protobuf::util::MessageDifferencer::Equals(left, right); +} + + bool operator==(const OperationStatus& left, const OperationStatus& right) { if (left.has_operation_id() != right.has_operation_id()) { @@ -478,6 +486,12 @@ bool operator==(const OperationStatus& left, const OperationStatus& right) } +bool operator!=(const Offer::Operation& left, const Offer::Operation& right) +{ + return !(left == right); +} + + bool operator!=(const OperationStatus& left, const OperationStatus& right) { return !(left == right); http://git-wip-us.apache.org/repos/asf/mesos/blob/ddecf8ee/src/v1/mesos.cpp ---------------------------------------------------------------------- diff --git a/src/v1/mesos.cpp b/src/v1/mesos.cpp index 576f367..1eb53f3 100644 --- a/src/v1/mesos.cpp +++ b/src/v1/mesos.cpp @@ -16,6 +16,8 @@ #include <ostream> +#include <google/protobuf/util/message_differencer.h> + #include <stout/protobuf.hpp> #include <stout/uuid.hpp> @@ -395,6 +397,18 @@ bool operator==(const MasterInfo& left, const MasterInfo& right) } +bool operator==(const Offer::Operation& left, const Offer::Operation& right) +{ + return google::protobuf::util::MessageDifferencer::Equals(left, right); +} + + +bool operator!=(const Offer::Operation& left, const Offer::Operation& right) +{ + return !(left == right); +} + + bool operator==( const ResourceProviderInfo::Storage& left, const ResourceProviderInfo::Storage& right)