You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/03/29 22:18:57 UTC

mesos git commit: Added ResourceProviderID.

Repository: mesos
Updated Branches:
  refs/heads/master 75c6dfaa9 -> 50dc133cd


Added ResourceProviderID.

This patch introduces a new type 'ResourceProviderID'. We will use
this id in later patches to mark resources with their abstract
providers (not necessarily an agent).

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


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

Branch: refs/heads/master
Commit: 50dc133cdb39221d1800c92127a8de284c5ecd13
Parents: 75c6dfa
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Mar 29 15:04:13 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Mar 29 15:04:13 2017 -0700

----------------------------------------------------------------------
 include/mesos/mesos.proto    |  9 +++++++++
 include/mesos/type_utils.hpp | 13 +++++++++++++
 include/mesos/v1/mesos.hpp   | 15 +++++++++++++++
 include/mesos/v1/mesos.proto |  9 +++++++++
 src/common/type_utils.cpp    |  8 ++++++++
 src/v1/mesos.cpp             | 20 ++++++++++++++++++++
 6 files changed, 74 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/50dc133c/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 4c1fd9f..dd90465 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -96,6 +96,15 @@ message ContainerID {
 
 
 /**
+ * A unique ID assigned to a resource provider. Currently, a resource
+ * provider gets a new ID whenever it (re)registers with Mesos.
+ */
+message ResourceProviderID {
+  required string value = 1;
+}
+
+
+/**
  * Represents time since the epoch, in nanoseconds.
  */
 message TimeInfo {

http://git-wip-us.apache.org/repos/asf/mesos/blob/50dc133c/include/mesos/type_utils.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp
index 90b0227..710c994 100644
--- a/include/mesos/type_utils.hpp
+++ b/include/mesos/type_utils.hpp
@@ -192,6 +192,14 @@ inline bool operator!=(const FrameworkID& left, const FrameworkID& right)
 }
 
 
+inline bool operator!=(
+    const ResourceProviderID& left,
+    const ResourceProviderID& right)
+{
+  return left.value() != right.value();
+}
+
+
 inline bool operator!=(const SlaveID& left, const SlaveID& right)
 {
   return left.value() != right.value();
@@ -288,6 +296,11 @@ std::ostream& operator<<(std::ostream& stream, const OfferID& offerId);
 std::ostream& operator<<(std::ostream& stream, const RateLimits& limits);
 
 
+std::ostream& operator<<(
+    std::ostream& stream,
+    const ResourceProviderID& resourceProviderId);
+
+
 std::ostream& operator<<(std::ostream& stream, const SlaveID& slaveId);
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/50dc133c/include/mesos/v1/mesos.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.hpp b/include/mesos/v1/mesos.hpp
index f91a574..b309a27 100644
--- a/include/mesos/v1/mesos.hpp
+++ b/include/mesos/v1/mesos.hpp
@@ -172,6 +172,11 @@ inline bool operator==(const MachineID& left, const MachineID& right)
 }
 
 
+bool operator==(
+    const ResourceProviderID& left,
+    const ResourceProviderID& right);
+
+
 inline bool operator!=(const ContainerID& left, const ContainerID& right)
 {
   return left.value() != right.value();
@@ -208,6 +213,11 @@ inline bool operator!=(const DurationInfo& left, const DurationInfo& right)
 }
 
 
+bool operator!=(
+    const ResourceProviderID& left,
+    const ResourceProviderID& right);
+
+
 inline bool operator<(const ContainerID& left, const ContainerID& right)
 {
   return left.value() < right.value();
@@ -325,6 +335,11 @@ std::ostream& operator<<(std::ostream& stream, const Image::Type& imageType);
 std::ostream& operator<<(std::ostream& stream, const Secret::Type& secretType);
 
 
+std::ostream& operator<<(
+    std::ostream& stream,
+    const ResourceProviderID& resourceProviderId);
+
+
 template <typename T>
 inline std::ostream& operator<<(
     std::ostream& stream,

http://git-wip-us.apache.org/repos/asf/mesos/blob/50dc133c/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 3324f0e..82d020e 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -96,6 +96,15 @@ message ContainerID {
 
 
 /**
+ * A unique ID assigned to a resource provider. Currently, a resource
+ * provider gets a new ID whenever it (re)registers with Mesos.
+ */
+message ResourceProviderID {
+  required string value = 1;
+}
+
+
+/**
  * Represents time since the epoch, in nanoseconds.
  */
 message TimeInfo {

http://git-wip-us.apache.org/repos/asf/mesos/blob/50dc133c/src/common/type_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index 9d87a6d..dc0dd71 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -558,6 +558,14 @@ ostream& operator<<(ostream& stream, const RateLimits& limits)
 }
 
 
+ostream& operator<<(
+    ostream& stream,
+    const ResourceProviderID& resourceProviderId)
+{
+  return stream << resourceProviderId.value();
+}
+
+
 ostream& operator<<(ostream& stream, const RLimitInfo& rlimitInfo)
 {
   return stream << JSON::protobuf(rlimitInfo);

http://git-wip-us.apache.org/repos/asf/mesos/blob/50dc133c/src/v1/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/v1/mesos.cpp b/src/v1/mesos.cpp
index 85db891..5605ff2 100644
--- a/src/v1/mesos.cpp
+++ b/src/v1/mesos.cpp
@@ -288,12 +288,24 @@ bool operator==(const Labels& left, const Labels& right)
 }
 
 
+bool operator==(const ResourceProviderID& left, const ResourceProviderID& right)
+{
+  return left.value() == right.value();
+}
+
+
 bool operator!=(const Labels& left, const Labels& right)
 {
   return !(left == right);
 }
 
 
+bool operator!=(const ResourceProviderID& left, const ResourceProviderID& right)
+{
+  return !(left == right);
+}
+
+
 bool operator==(const DiscoveryInfo& left, const DiscoveryInfo& right)
 {
   return left.visibility() == right.visibility() &&
@@ -563,6 +575,14 @@ ostream& operator<<(ostream& stream, const Secret::Type& secretType)
 }
 
 
+ostream& operator<<(
+    ostream& stream,
+    const ResourceProviderID& resourceProviderId)
+{
+  return stream << resourceProviderId.value();
+}
+
+
 ostream& operator<<(ostream& stream, const hashmap<string, string>& map)
 {
   return stream << stringify(map);