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:25 UTC

[4/9] mesos git commit: Added flag protobuf message for agent capabilities.

Added flag protobuf message for agent capabilities.

See summary.

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


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

Branch: refs/heads/master
Commit: ca4956206a06026e2fd0ca30bdacaf7e4a8cb5b5
Parents: 439825f
Author: Benjamin Bannier <bb...@apache.org>
Authored: Wed Nov 8 00:51:40 2017 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Wed Nov 8 15:51:20 2017 +0100

----------------------------------------------------------------------
 src/messages/flags.hpp   | 21 +++++++++++++++++++++
 src/messages/flags.proto |  8 ++++++++
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ca495620/src/messages/flags.hpp
----------------------------------------------------------------------
diff --git a/src/messages/flags.hpp b/src/messages/flags.hpp
index b267677..00e26cd 100644
--- a/src/messages/flags.hpp
+++ b/src/messages/flags.hpp
@@ -58,6 +58,19 @@ inline Try<mesos::internal::ContainerDNSInfo> parse(const std::string& value)
   return protobuf::parse<mesos::internal::ContainerDNSInfo>(json.get());
 }
 
+
+template <>
+inline Try<mesos::internal::SlaveCapabilities> parse(const std::string& value)
+{
+  // Convert from string or file to JSON.
+  Try<JSON::Object> json = parse<JSON::Object>(value);
+  if (json.isError()) {
+    return Error(json.error());
+  }
+
+  return protobuf::parse<mesos::internal::SlaveCapabilities>(json.get());
+}
+
 } // namespace flags {
 
 namespace mesos {
@@ -78,6 +91,14 @@ inline std::ostream& operator<<(
   return stream << dns.DebugString();
 }
 
+
+inline std::ostream& operator<<(
+    std::ostream& stream,
+    const SlaveCapabilities& slaveCapabilities)
+{
+  return stream << slaveCapabilities.DebugString();
+}
+
 } // namespace internal {
 } // namespace mesos {
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/ca495620/src/messages/flags.proto
----------------------------------------------------------------------
diff --git a/src/messages/flags.proto b/src/messages/flags.proto
index 077353c..7ae9ef8 100644
--- a/src/messages/flags.proto
+++ b/src/messages/flags.proto
@@ -16,6 +16,8 @@
 
 syntax = "proto2";
 
+import "mesos/mesos.proto";
+
 import "slave/containerizer/mesos/isolators/network/cni/spec.proto";
 
 package mesos.internal;
@@ -97,3 +99,9 @@ message ContainerDNSInfo {
   repeated MesosInfo mesos = 1;
   repeated DockerInfo docker = 2;
 }
+
+
+// Describes a set of agent capabilities.
+message SlaveCapabilities {
+  repeated SlaveInfo.Capability capabilities = 1;
+}