80 lines
2.1 KiB
C++
80 lines
2.1 KiB
C++
/*
|
|
* File: PartitionTimer.h
|
|
* Author: gschneid
|
|
* Author: jgaebler
|
|
*
|
|
* Created on August 8, 2012, 10:17 AM
|
|
*/
|
|
#pragma once
|
|
|
|
#ifndef PARTITIONTIMER_H
|
|
#define PARTITIONTIMER_H
|
|
|
|
#include "common/timer/MoversightTimer.h"
|
|
#include "fd/partition/NeighborhoodDetectionQueue.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class PartitionDetector;
|
|
|
|
/**
|
|
* @class PartitionTimer
|
|
* @brief Timer to monitor the partitionDetection. Keeps the needed queues of reachable and nonreachable peers.
|
|
* @author Grit Schneider
|
|
* @author: Jan Gäbler
|
|
* @ingroup Moversight
|
|
*/
|
|
class PartitionTimer: public MoversightTimer {
|
|
|
|
public:
|
|
|
|
PartitionTimer(PartitionDetector & aPd);
|
|
virtual ~PartitionTimer();
|
|
PartitionTimer(const PartitionTimer & other);
|
|
|
|
virtual void timeout();
|
|
PartitionTimer* dup();
|
|
|
|
bool isMandatory();
|
|
void setIsMandatory(bool flag);
|
|
void markAsReachable(PeerID foundPeer);
|
|
void updateDueToConnectionLoss(PeerID lostPeer);
|
|
void addingPeerSetToNonReachableList(PeerIDList peerSet);
|
|
PeerIDList getNonReachablePeerIDList();
|
|
PeerIDList getReachablePeerIDList();
|
|
PeerIDList getNonReachableMasters();
|
|
bool isNonReachableQueueEmpty();
|
|
|
|
void updateListsDueToDisconnectedPeer(PeerID pId);
|
|
PeerIDList getDisconnectedPeers();
|
|
void setNonReachablePeersFromMR();
|
|
|
|
PeerID & getReReachablePeerID();
|
|
void setReReachablePeerID(PeerID pID);
|
|
|
|
private:
|
|
|
|
enum PartitionTimerType {
|
|
PT_UNDEFINED,
|
|
PT_MANDATORY,
|
|
PT_OPTIONAL
|
|
};
|
|
|
|
NeighborhoodDetectionQueue reachablePeers;
|
|
NeighborhoodDetectionQueue nonReachablePeers;
|
|
PeerIDList peersDisconnectedDuringPartition;
|
|
|
|
|
|
|
|
PeerID reReachablePeerID;
|
|
PartitionTimerType partitionTimerType;
|
|
PartitionDetector & pd;
|
|
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif /* PARTITIONTIMER_H */
|
|
|