72 lines
1.9 KiB
C++
72 lines
1.9 KiB
C++
#ifndef MAINTANCEROLESERVICE_H
|
|
#define MAINTANCEROLESERVICE_H
|
|
|
|
#include "common/MoversightService.h"
|
|
#include "mrs/metric/MaintanceMomentMetricTypes.h"
|
|
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class Dispatcher;
|
|
class MulticastMessage;
|
|
class MaintanceMomentMetric;
|
|
|
|
/**
|
|
* @brief Class Manage roleswitch between master and slaves
|
|
* @class MaintanceRoleService
|
|
* @author Felix Stubbe
|
|
* @ingroup Moversight
|
|
*/
|
|
class MaintenanceRoleService : public MoversightService {
|
|
friend class MaintanceMomentMetric;
|
|
|
|
public:
|
|
|
|
MaintenanceRoleService(Dispatcher & d);
|
|
|
|
MaintenanceRoleService(const MaintenanceRoleService & orig);
|
|
|
|
virtual ~MaintenanceRoleService();
|
|
|
|
void initialise();
|
|
|
|
void finalise();
|
|
|
|
void activatedSendMessageSema();
|
|
|
|
void deactivatedSendMessageSema();
|
|
|
|
void runRoleSwitch();
|
|
|
|
void updateMaintanceMomentMetric(const MulticastMessage & pdu, bool globalState);
|
|
|
|
void refreshMasterIdTreshholdMap();
|
|
|
|
void forceRoleSwitch(PeerID masterId);
|
|
|
|
void sendRSAMessage(PeerID masterId);
|
|
|
|
MaintenanceRoleService & operator=(const MaintenanceRoleService & rhs);
|
|
|
|
bool useMomentMetricGlobalsStates();
|
|
|
|
virtual void handleEvent(const PeerJoinedEvent & e);
|
|
virtual void handleEvent(const PeerLeftEvent & e);
|
|
virtual void handleEvent(const JoinGroupDoneEvent & e);
|
|
virtual void handleEvent(const FlushDoneEvent & e);
|
|
virtual void handleEvent(const MulticastMessageDeliveredEvent & e);
|
|
virtual void handleEvent(const MulticastMessageEnqueuedEvent & e);
|
|
|
|
private:
|
|
|
|
void setMaintanceMomentMetric(MaintanceMomentMetricType type);
|
|
|
|
MaintanceMomentMetric * mmMetric;
|
|
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif // MAINTANCEROLESERVICE_H
|