You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2018/08/28 21:15:33 UTC

[mesos] branch master updated: Cleaned up formatting in "master/http.cpp".

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


The following commit(s) were added to refs/heads/master by this push:
     new f83f462  Cleaned up formatting in "master/http.cpp".
f83f462 is described below

commit f83f462adc299415094fa2545e6cadb5c26a2787
Author: Alexander Rukletsov <al...@apache.org>
AuthorDate: Tue Aug 28 23:12:18 2018 +0200

    Cleaned up formatting in "master/http.cpp".
---
 src/master/http.cpp | 98 ++++++++++++++++++++++++++---------------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/master/http.cpp b/src/master/http.cpp
index 85413cb..e074a93 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -1383,7 +1383,7 @@ Future<Response> Master::Http::getExecutors(
 
 
 mesos::master::Response::GetExecutors Master::Http::_getExecutors(
-      const Owned<ObjectApprovers>& approvers) const
+    const Owned<ObjectApprovers>& approvers) const
 {
   // Construct framework list with both active and completed frameworks.
   vector<const Framework*> frameworks;
@@ -1531,19 +1531,19 @@ Future<Response> Master::Http::flags(
   Option<string> jsonp = request.url.query.get("jsonp");
 
   return _flags(principal)
-      .then([jsonp](const Try<JSON::Object, FlagsError>& flags)
-            -> Future<Response> {
-        if (flags.isError()) {
-          switch (flags.error().type) {
-            case FlagsError::Type::UNAUTHORIZED:
-              return Forbidden();
-          }
-
-          return InternalServerError(flags.error().message);
+    .then([jsonp](const Try<JSON::Object, FlagsError>& flags)
+          -> Future<Response> {
+      if (flags.isError()) {
+        switch (flags.error().type) {
+          case FlagsError::Type::UNAUTHORIZED:
+            return Forbidden();
         }
 
-        return OK(flags.get(), jsonp);
-      });
+        return InternalServerError(flags.error().message);
+      }
+
+      return OK(flags.get(), jsonp);
+    });
 }
 
 
@@ -1563,15 +1563,15 @@ Future<Try<JSON::Object, Master::Http::FlagsError>> Master::Http::_flags(
   }
 
   return master->authorizer.get()->authorized(authRequest)
-      .then(defer(
-          master->self(),
-          [this](bool authorized) -> Future<Try<JSON::Object, FlagsError>> {
-        if (authorized) {
-          return __flags();
-        } else {
-          return FlagsError(FlagsError::Type::UNAUTHORIZED);
-        }
-      }));
+    .then(defer(
+        master->self(),
+        [this](bool authorized) -> Future<Try<JSON::Object, FlagsError>> {
+      if (authorized) {
+        return __flags();
+      } else {
+        return FlagsError(FlagsError::Type::UNAUTHORIZED);
+      }
+    }));
 }
 
 
@@ -1602,22 +1602,22 @@ Future<Response> Master::Http::getFlags(
   CHECK_EQ(mesos::master::Call::GET_FLAGS, call.type());
 
   return _flags(principal)
-      .then([contentType](const Try<JSON::Object, FlagsError>& flags)
-            -> Future<Response> {
-        if (flags.isError()) {
-          switch (flags.error().type) {
-            case FlagsError::Type::UNAUTHORIZED:
-              return Forbidden();
-          }
-
-          return InternalServerError(flags.error().message);
+    .then([contentType](const Try<JSON::Object, FlagsError>& flags)
+          -> Future<Response> {
+      if (flags.isError()) {
+        switch (flags.error().type) {
+          case FlagsError::Type::UNAUTHORIZED:
+            return Forbidden();
         }
 
-        return OK(
-            serialize(contentType,
-                      evolve<v1::master::Response::GET_FLAGS>(flags.get())),
-            stringify(contentType));
-      });
+        return InternalServerError(flags.error().message);
+      }
+
+      return OK(
+          serialize(contentType,
+                    evolve<v1::master::Response::GET_FLAGS>(flags.get())),
+          stringify(contentType));
+    });
 }
 
 
@@ -1682,21 +1682,21 @@ Future<Response> Master::Http::getMetrics(
   }
 
   return process::metrics::snapshot(timeout)
-      .then([contentType](const map<string, double>& metrics) -> Response {
-        mesos::master::Response response;
-        response.set_type(mesos::master::Response::GET_METRICS);
-        mesos::master::Response::GetMetrics* _getMetrics =
-          response.mutable_get_metrics();
-
-        foreachpair (const string& key, double value, metrics) {
-          Metric* metric = _getMetrics->add_metrics();
-          metric->set_name(key);
-          metric->set_value(value);
-        }
+    .then([contentType](const map<string, double>& metrics) -> Response {
+      mesos::master::Response response;
+      response.set_type(mesos::master::Response::GET_METRICS);
+      mesos::master::Response::GetMetrics* _getMetrics =
+        response.mutable_get_metrics();
+
+      foreachpair (const string& key, double value, metrics) {
+        Metric* metric = _getMetrics->add_metrics();
+        metric->set_name(key);
+        metric->set_value(value);
+      }
 
-        return OK(serialize(contentType, evolve(response)),
-                  stringify(contentType));
-      });
+      return OK(serialize(contentType, evolve(response)),
+                stringify(contentType));
+    });
 }