1
0
Fork 0

cluster startup and supervision

This commit is contained in:
Kaveh Vahedipour 2016-04-18 16:13:30 +02:00
parent 313140e0e1
commit 114b643d6e
3 changed files with 20 additions and 17 deletions

View File

@ -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();
}

View File

@ -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__

View File

@ -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