16 #ifndef STATESTORE_FAILURE_DETECTOR_H
17 #define STATESTORE_FAILURE_DETECTOR_H
19 #include <boost/thread/thread_time.hpp>
21 #include <boost/date_time/posix_time/posix_time_types.hpp>
22 #include <boost/thread/mutex.hpp>
59 virtual void EvictPeer(
const std::string& peer) = 0;
75 boost::posix_time::time_duration suspect_timeout)
83 virtual void EvictPeer(
const std::string& peer);
115 int32_t suspect_missed_heartbeats)
123 virtual void EvictPeer(
const std::string& peer);
143 #endif // IMPALA_SPARROW_FAILURE_DETECTOR_H
int32_t suspect_missed_heartbeats_
const boost::posix_time::time_duration suspect_timeout_
MissedHeartbeatFailureDetector(int32_t max_missed_heartbeats, int32_t suspect_missed_heartbeats)
virtual PeerState GetPeerState(const std::string &peer)
Returns the current estimated state of a peer.
boost::mutex lock_
Protects all members.
virtual void EvictPeer(const std::string &peer)
Remove a peer from the failure detector completely.
virtual PeerState GetPeerState(const std::string &peer)=0
Returns the current estimated state of a peer.
const boost::posix_time::time_duration failure_timeout_
virtual PeerState UpdateHeartbeat(const std::string &peer, bool seen)=0
virtual PeerState GetPeerState(const std::string &peer)
Returns the current estimated state of a peer.
virtual void EvictPeer(const std::string &peer)
Remove a peer from the failure detector completely.
boost::mutex lock_
Protects all members.
int32_t max_missed_heartbeats_
static const std::string & PeerStateToString(PeerState peer_state)
Utility method to convert a PeerState enum to a string.
std::map< std::string, boost::system_time > peer_heartbeat_record_
Record of last time a successful heartbeat was received.
TimeoutFailureDetector(boost::posix_time::time_duration failure_timeout, boost::posix_time::time_duration suspect_timeout)
virtual ~FailureDetector()
std::map< std::string, int32_t > missed_heartbeat_counts_
Number of consecutive heartbeats missed by peer.
virtual PeerState UpdateHeartbeat(const std::string &peer, bool seen)
virtual void EvictPeer(const std::string &peer)=0
Remove a peer from the failure detector completely.
virtual PeerState UpdateHeartbeat(const std::string &peer, bool seen)