From 114b643d6e8e73e7a4bbbcb16fb858eca1bf1500 Mon Sep 17 00:00:00 2001 From: Kaveh Vahedipour Date: Mon, 18 Apr 2016 16:13:30 +0200 Subject: [PATCH] cluster startup and supervision --- .../{SanityCheck.cpp => Supervision.cpp} | 18 +++++++++--------- .../Agency/{SanityCheck.h => Supervision.h} | 17 ++++++++++------- arangod/CMakeLists.txt | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) rename arangod/Agency/{SanityCheck.cpp => Supervision.cpp} (67%) rename arangod/Agency/{SanityCheck.h => Supervision.h} (86%) diff --git a/arangod/Agency/SanityCheck.cpp b/arangod/Agency/Supervision.cpp similarity index 67% rename from arangod/Agency/SanityCheck.cpp rename to arangod/Agency/Supervision.cpp index 7c719a039d..7516610e09 100644 --- a/arangod/Agency/SanityCheck.cpp +++ b/arangod/Agency/Supervision.cpp @@ -1,26 +1,26 @@ -#include "SanityCheck.h" +#include "Supervision.h" #include "Agent.h" #include "Basics/ConditionLocker.h" using namespace arangodb::consensus; -SanityCheck::SanityCheck() : arangodb::Thread("SanityCheck"), _agent(nullptr) {} +Supervision::Supervision() : arangodb::Thread("Supervision"), _agent(nullptr) {} -SanityCheck::~SanityCheck() { +Supervision::~Supervision() { shutdown(); }; -void SanityCheck::wakeUp () { +void Supervision::wakeUp () { _cv.signal(); } -bool SanityCheck::doChecks (bool timedout) { +bool Supervision::doChecks (bool timedout) { LOG_TOPIC(INFO, Logger::AGENCY) << "Sanity checks"; return true; } -void SanityCheck::run() { +void Supervision::run() { CONDITION_LOCKER(guard, _cv); TRI_ASSERT(_agent!=nullptr); @@ -41,18 +41,18 @@ void SanityCheck::run() { } // Start thread -bool SanityCheck::start () { +bool Supervision::start () { Thread::start(); return true; } // Start thread with agent -bool SanityCheck::start (Agent* agent) { +bool Supervision::start (Agent* agent) { _agent = agent; return start(); } -void SanityCheck::beginShutdown() { +void Supervision::beginShutdown() { // Personal hygiene Thread::beginShutdown(); } diff --git a/arangod/Agency/SanityCheck.h b/arangod/Agency/Supervision.h similarity index 86% rename from arangod/Agency/SanityCheck.h rename to arangod/Agency/Supervision.h index 36fb547d0e..699e72dadf 100644 --- a/arangod/Agency/SanityCheck.h +++ b/arangod/Agency/Supervision.h @@ -21,8 +21,8 @@ /// @author Kaveh Vahedipour //////////////////////////////////////////////////////////////////////////////// -#ifndef __ARANGODB_CONSENSUS_SANITY_CHECK__ -#define __ARANGODB_CONSENSUS_SANITY_CHECK__ +#ifndef __ARANGODB_CONSENSUS_SUPERVISION__ +#define __ARANGODB_CONSENSUS_SUPERVISION__ #include "Basics/Thread.h" #include "Basics/ConditionVariable.h" @@ -32,15 +32,15 @@ namespace consensus { class Agent; -class SanityCheck : public arangodb::Thread { +class Supervision : public arangodb::Thread { public: /// @brief Construct sanity checking - SanityCheck (); + Supervision (); /// @brief Default dtor - ~SanityCheck (); + ~Supervision (); /// @brief Start thread bool start (); @@ -59,16 +59,19 @@ public: private: + /// @brief Read db + Store const& store (); + /// @brief Perform sanity checking bool doChecks(bool); Agent* _agent; /**< @brief My agent */ arangodb::basics::ConditionVariable _cv; /**< @brief Control if thread should run */ - + }; }} -#endif //__ARANGODB_CONSENSUS_SANITY_CHECK__ +#endif //__ARANGODB_CONSENSUS_SUPERVISION__ diff --git a/arangod/CMakeLists.txt b/arangod/CMakeLists.txt index bc40b7ad5e..38ef0800a8 100644 --- a/arangod/CMakeLists.txt +++ b/arangod/CMakeLists.txt @@ -72,7 +72,7 @@ add_executable(${BIN_ARANGOD} Agency/AgentCallback.cpp Agency/ApplicationAgency.cpp Agency/Constituent.cpp - Agency/SanityCheck.cpp + Agency/Supervision.cpp Agency/RestAgencyHandler.cpp Agency/RestAgencyPrivHandler.cpp Agency/State.cpp