mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From al...@apache.org
Subject [mesos] 03/06: Added '/slaves' to the set of batched master endpoints.
Date Tue, 28 Aug 2018 19:50:13 GMT
This is an automated email from the ASF dual-hosted git repository.

alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 33c38c9baa20b42562b519971df508283d988abc
Author: Benno Evers <bevers@mesosphere.com>
AuthorDate: Tue Aug 28 21:26:11 2018 +0200

    Added '/slaves' to the set of batched master endpoints.
    
    Review: https://reviews.apache.org/r/68441/
---
 src/master/http.cpp   | 27 +++++++++++++++++----------
 src/master/master.hpp |  5 +++++
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/master/http.cpp b/src/master/http.cpp
index 897c80d..42d4dad 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -2517,6 +2517,20 @@ string Master::Http::SLAVES_HELP()
 }
 
 
+process::http::Response Master::ReadOnlyHandler::slaves(
+    const process::http::Request& request,
+    const process::Owned<ObjectApprovers>& approvers) const
+{
+  Option<string> slaveId = request.url.query.get("slave_id");
+  Option<string> jsonp = request.url.query.get("jsonp");
+  IDAcceptor<SlaveID> selectSlaveId(slaveId);
+
+  return process::http::OK(
+      jsonify(SlavesWriter(master->slaves, approvers, selectSlaveId)),
+      jsonp);
+}
+
+
 Future<Response> Master::Http::slaves(
     const Request& request,
     const Option<Principal>& principal) const
@@ -2526,19 +2540,12 @@ Future<Response> Master::Http::slaves(
     return redirect(request);
   }
 
-  Option<string> slaveId = request.url.query.get("slave_id");
-  Option<string> jsonp = request.url.query.get("jsonp");
-
   return ObjectApprovers::create(master->authorizer, principal, {VIEW_ROLE})
     .then(defer(
         master->self(),
-        [this, slaveId, jsonp](const Owned<ObjectApprovers>& approvers)
-            -> Response {
-          IDAcceptor<SlaveID> selectSlaveId(slaveId);
-
-          return OK(
-              jsonify(SlavesWriter(master->slaves, approvers, selectSlaveId)),
-              jsonp);
+        [this, request](const Owned<ObjectApprovers>& approvers) {
+          return deferBatchedRequest(
+              &Master::ReadOnlyHandler::slaves, request, approvers);
         }));
 }
 
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 381db90..ac6e6d3 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -1411,6 +1411,11 @@ private:
         const process::http::Request& request,
         const process::Owned<ObjectApprovers>& approvers) const;
 
+    // /slaves
+    process::http::Response slaves(
+        const process::http::Request& request,
+        const process::Owned<ObjectApprovers>& approvers) const;
+
   private:
     const Master* master;
   };


Mime
View raw message