72 lines
1.7 KiB
C++
72 lines
1.7 KiB
C++
/*
|
|
* File: FailureDetector.h
|
|
* Author: jgaebler
|
|
*
|
|
* Created on July 31, 2012, 9:42 AM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef FAILUREDETECTOR_H
|
|
#define FAILUREDETECTOR_H
|
|
|
|
#include "common/MoversightService.h"
|
|
#include "fd/events/PeerFailedEvent.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class MoversightMessage;
|
|
class NetworkFailureDetector;
|
|
class PartitionDetector;
|
|
|
|
/**
|
|
* @brief A network failure detector service for moversight. It monitors
|
|
* other peers and detect peer failure and network partitions.
|
|
* @class FailureDetector
|
|
* @author Jan Gäbler
|
|
* @ingroup Moversight
|
|
*/
|
|
class FailureDetector : public MoversightService {
|
|
|
|
public:
|
|
|
|
FailureDetector(Dispatcher & d);
|
|
|
|
virtual ~FailureDetector();
|
|
|
|
virtual void initialise();
|
|
|
|
virtual void finalise();
|
|
|
|
virtual void handleMessage(const MoversightMessage * pdu);
|
|
|
|
MoversightService& operator=(const FailureDetector & other);
|
|
|
|
void startND(const PeerIDList & unreachable);
|
|
void stopND();
|
|
void finaliseND();
|
|
|
|
void updatePartitionDetector(PeerID pID);
|
|
|
|
NetworkFailureDetector & getNetworkFailureDetector();
|
|
const NetworkFailureDetector & getNetworkFailureDetector() const;
|
|
|
|
// -----------------------------------------------------------------
|
|
// Event Handling
|
|
virtual void handleEvent(const PeerFailedEvent & e);
|
|
virtual void handleEvent(const GroupClosedEvent & e);
|
|
|
|
private:
|
|
|
|
NetworkFailureDetector * nfd;
|
|
PartitionDetector * pd;
|
|
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif /* FAILUREDETECTOR_H */
|
|
|
|
|
|
|