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 2016/11/25 15:19:41 UTC

[02/11] mesos git commit: Renamed functions in HealthChecker for clarity.

Renamed functions in HealthChecker for clarity.

Use descriptive function names instead of underscore
prefixes for functions in HealthChecker.

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


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

Branch: refs/heads/master
Commit: 89e41289ab1df3ab9328ffa0e2a5c7396e3e59eb
Parents: c428b8b
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Fri Nov 25 16:13:24 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Fri Nov 25 16:13:24 2016 +0100

----------------------------------------------------------------------
 src/health-check/health_checker.cpp | 36 +++++++++++++-------------------
 src/health-check/health_checker.hpp | 15 +++++++------
 2 files changed, 22 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/89e41289/src/health-check/health_checker.cpp
----------------------------------------------------------------------
diff --git a/src/health-check/health_checker.cpp b/src/health-check/health_checker.cpp
index c4f6670..4a02e86 100644
--- a/src/health-check/health_checker.cpp
+++ b/src/health-check/health_checker.cpp
@@ -185,12 +185,6 @@ HealthCheckerProcess::HealthCheckerProcess(
 
 void HealthCheckerProcess::initialize()
 {
-  healthCheck();
-}
-
-
-void HealthCheckerProcess::healthCheck()
-{
   VLOG(1) << "Health check starting in "
           << Seconds(static_cast<int64_t>(check.delay_seconds()))
           << ", grace period "
@@ -200,7 +194,7 @@ void HealthCheckerProcess::healthCheck()
 
   delay(Seconds(static_cast<int64_t>(check.delay_seconds())),
         self(),
-        &Self::_healthCheck);
+        &Self::performSingleCheck);
 }
 
 
@@ -257,23 +251,23 @@ void HealthCheckerProcess::success()
 }
 
 
-void HealthCheckerProcess::_healthCheck()
+void HealthCheckerProcess::performSingleCheck()
 {
   Future<Nothing> checkResult;
 
   switch (check.type()) {
     case HealthCheck::COMMAND: {
-      checkResult = _commandHealthCheck();
+      checkResult = commandHealthCheck();
       break;
     }
 
     case HealthCheck::HTTP: {
-      checkResult = _httpHealthCheck();
+      checkResult = httpHealthCheck();
       break;
     }
 
     case HealthCheck::TCP: {
-      checkResult = _tcpHealthCheck();
+      checkResult = tcpHealthCheck();
       break;
     }
 
@@ -282,11 +276,11 @@ void HealthCheckerProcess::_healthCheck()
     }
   }
 
-  checkResult.onAny(defer(self(), &Self::__healthCheck, lambda::_1));
+  checkResult.onAny(defer(self(), &Self::processCheckResult, lambda::_1));
 }
 
 
-void HealthCheckerProcess::__healthCheck(const Future<Nothing>& future)
+void HealthCheckerProcess::processCheckResult(const Future<Nothing>& future)
 {
   if (future.isReady()) {
     success();
@@ -301,7 +295,7 @@ void HealthCheckerProcess::__healthCheck(const Future<Nothing>& future)
 }
 
 
-Future<Nothing> HealthCheckerProcess::_commandHealthCheck()
+Future<Nothing> HealthCheckerProcess::commandHealthCheck()
 {
   CHECK_EQ(HealthCheck::COMMAND, check.type());
   CHECK(check.has_command());
@@ -387,7 +381,7 @@ Future<Nothing> HealthCheckerProcess::_commandHealthCheck()
 }
 
 
-Future<Nothing> HealthCheckerProcess::_httpHealthCheck()
+Future<Nothing> HealthCheckerProcess::httpHealthCheck()
 {
   CHECK_EQ(HealthCheck::HTTP, check.type());
   CHECK(check.has_http());
@@ -452,11 +446,11 @@ Future<Nothing> HealthCheckerProcess::_httpHealthCheck()
           string(HTTP_CHECK_COMMAND) + " has not returned after " +
           stringify(timeout) + "; aborting");
     })
-    .then(defer(self(), &Self::__httpHealthCheck, lambda::_1));
+    .then(defer(self(), &Self::_httpHealthCheck, lambda::_1));
 }
 
 
-Future<Nothing> HealthCheckerProcess::__httpHealthCheck(
+Future<Nothing> HealthCheckerProcess::_httpHealthCheck(
     const tuple<
         Future<Option<int>>,
         Future<string>,
@@ -515,7 +509,7 @@ Future<Nothing> HealthCheckerProcess::__httpHealthCheck(
 }
 
 
-Future<Nothing> HealthCheckerProcess::_tcpHealthCheck()
+Future<Nothing> HealthCheckerProcess::tcpHealthCheck()
 {
   CHECK_EQ(HealthCheck::TCP, check.type());
   CHECK(check.has_tcp());
@@ -575,11 +569,11 @@ Future<Nothing> HealthCheckerProcess::_tcpHealthCheck()
           string(TCP_CHECK_COMMAND) + " has not returned after " +
           stringify(timeout) + "; aborting");
     })
-    .then(defer(self(), &Self::__tcpHealthCheck, lambda::_1));
+    .then(defer(self(), &Self::_tcpHealthCheck, lambda::_1));
 }
 
 
-Future<Nothing> HealthCheckerProcess::__tcpHealthCheck(
+Future<Nothing> HealthCheckerProcess::_tcpHealthCheck(
     const tuple<
         Future<Option<int>>,
         Future<string>,
@@ -623,7 +617,7 @@ void HealthCheckerProcess::reschedule()
 
   delay(Seconds(static_cast<int64_t>(check.interval_seconds())),
         self(),
-        &Self::_healthCheck);
+        &Self::performSingleCheck);
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/89e41289/src/health-check/health_checker.hpp
----------------------------------------------------------------------
diff --git a/src/health-check/health_checker.hpp b/src/health-check/health_checker.hpp
index edd9bc7..ce0a232 100644
--- a/src/health-check/health_checker.hpp
+++ b/src/health-check/health_checker.hpp
@@ -96,23 +96,22 @@ private:
   void failure(const std::string& message);
   void success();
 
-  void healthCheck();
-  void _healthCheck();
-  void __healthCheck(const process::Future<Nothing>& future);
+  void performSingleCheck();
+  void processCheckResult(const process::Future<Nothing>& future);
 
-  process::Future<Nothing> _commandHealthCheck();
+  process::Future<Nothing> commandHealthCheck();
 
-  process::Future<Nothing> _httpHealthCheck();
+  process::Future<Nothing> httpHealthCheck();
 
-  process::Future<Nothing> __httpHealthCheck(
+  process::Future<Nothing> _httpHealthCheck(
       const std::tuple<
           process::Future<Option<int>>,
           process::Future<std::string>,
           process::Future<std::string>>& t);
 
-  process::Future<Nothing> _tcpHealthCheck();
+  process::Future<Nothing> tcpHealthCheck();
 
-  process::Future<Nothing> __tcpHealthCheck(
+  process::Future<Nothing> _tcpHealthCheck(
       const std::tuple<
           process::Future<Option<int>>,
           process::Future<std::string>,