OverSim
|
#include <NiceCluster.h>
Public Member Functions | |
NiceCluster () | |
void | add (const TransportAddress &member) |
Adds address to cluster. | |
void | clear () |
Removes all addresses from cluster, sets leader to unspecified address and sets last lt to 0. | |
bool | contains (const TransportAddress &member) |
Tests if given address is in cluster. | |
int | getSize () |
Returns number of addresses in cluster. | |
const TransportAddress & | get (int i) |
Returns i-th address in cluster, counting by order. | |
void | remove (const TransportAddress &member) |
Removes address from cluster. | |
void | setLeader (const TransportAddress &leader) |
Set leader to given address. | |
const TransportAddress & | getLeader () |
Returns leader address. | |
std::set< TransportAddress > ::const_iterator | begin () const |
Returns const iterator to first address. | |
std::set< TransportAddress > ::const_iterator | end () const |
Returns const iterator to end of cluster. | |
simtime_t | getLastLT () |
void | setLastLT () |
bool | isLeaderConfirmed () |
The leader is "confirmed", when we can say reasonably sure that all the nodes in the cluster think of the leader as the leader. | |
void | confirmLeader () |
Confirm that we're sure that our leader information is correct. | |
int | getLeaderHeartbeatsSent () |
void | setLeaderHeartbeatsSent (int heartbeats) |
Private Types | |
typedef std::set < TransportAddress > ::const_iterator | ConstClusterIterator |
typedef std::set < TransportAddress >::iterator | ClusterIterator |
Private Attributes | |
std::set< TransportAddress > | cluster |
TransportAddress | leader |
simtime_t | lastLT |
bool | leaderConfirmed |
int | leaderHeartbeatsSent |
Definition at line 30 of file NiceCluster.h.
|
private |
Definition at line 51 of file NiceCluster.h.
|
private |
Definition at line 50 of file NiceCluster.h.
NiceCluster::NiceCluster | ( | ) |
Definition at line 28 of file NiceCluster.cc.
void NiceCluster::add | ( | const TransportAddress & | member | ) |
Adds address to cluster.
Definition at line 42 of file NiceCluster.cc.
Referenced by oversim::Nice::changeState(), oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceJoinCluster(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::handleNiceQuery(), oversim::Nice::handleNiceQueryResponse(), oversim::Nice::JoinCluster(), and oversim::Nice::maintenance().
std::set< TransportAddress >::const_iterator NiceCluster::begin | ( | ) | const |
Returns const iterator to first address.
Definition at line 123 of file NiceCluster.cc.
Referenced by oversim::Nice::findCenter(), oversim::Nice::handleNiceLeaderHeartbeat(), and oversim::Nice::handleNiceLeaderTransfer().
void NiceCluster::clear | ( | ) |
Removes all addresses from cluster, sets leader to unspecified address and sets last lt to 0.
Definition at line 50 of file NiceCluster.cc.
Referenced by oversim::Nice::ClusterSplit(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::initializeOverlay(), and oversim::Nice::maintenance().
void NiceCluster::confirmLeader | ( | ) |
Confirm that we're sure that our leader information is correct.
Definition at line 152 of file NiceCluster.cc.
Referenced by oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), oversim::Nice::handleNiceLeaderHeartbeat(), and oversim::Nice::sendHeartbeats().
bool NiceCluster::contains | ( | const TransportAddress & | member | ) |
Tests if given address is in cluster.
Definition at line 61 of file NiceCluster.cc.
Referenced by oversim::Nice::handleNicePingProbe(), oversim::Nice::handleNiceRemove(), setLeader(), and oversim::Nice::updateVisualization().
std::set< TransportAddress >::const_iterator NiceCluster::end | ( | ) | const |
Returns const iterator to end of cluster.
Definition at line 128 of file NiceCluster.cc.
Referenced by oversim::Nice::ClusterSplit(), oversim::Nice::findCenter(), oversim::Nice::gracefulLeave(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::initializeOverlay(), and oversim::Nice::maintenance().
const TransportAddress & NiceCluster::get | ( | int | i | ) |
Returns i-th address in cluster, counting by order.
Definition at line 78 of file NiceCluster.cc.
Referenced by oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), oversim::Nice::gracefulLeave(), oversim::Nice::handleNiceQuery(), oversim::Nice::maintenance(), oversim::Nice::sendDataToOverlay(), oversim::Nice::sendHeartbeats(), and oversim::Nice::updateVisualization().
simtime_t NiceCluster::getLastLT | ( | ) |
Definition at line 133 of file NiceCluster.cc.
const TransportAddress & NiceCluster::getLeader | ( | ) |
Returns leader address.
Definition at line 116 of file NiceCluster.cc.
Referenced by oversim::Nice::ClusterSplit(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::handleNiceRemove(), oversim::Nice::maintenance(), oversim::Nice::sendHeartbeats(), and oversim::Nice::splitNeeded().
int NiceCluster::getLeaderHeartbeatsSent | ( | ) |
Definition at line 157 of file NiceCluster.cc.
int NiceCluster::getSize | ( | ) |
Returns number of addresses in cluster.
Definition at line 70 of file NiceCluster.cc.
Referenced by oversim::Nice::ClusterMerge(), oversim::Nice::ClusterMergeRequest(), oversim::Nice::ClusterSplit(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::handleNiceQuery(), oversim::Nice::maintenance(), oversim::Nice::sendDataToOverlay(), oversim::Nice::sendHeartbeats(), oversim::Nice::sendHeartbeatTo(), oversim::Nice::splitNeeded(), and oversim::Nice::updateVisualization().
bool NiceCluster::isLeaderConfirmed | ( | ) |
The leader is "confirmed", when we can say reasonably sure that all the nodes in the cluster think of the leader as the leader.
Definition at line 147 of file NiceCluster.cc.
Referenced by oversim::Nice::maintenance(), and oversim::Nice::splitNeeded().
void NiceCluster::remove | ( | const TransportAddress & | member | ) |
Removes address from cluster.
If address is leader, sets leader to unspecified address.
Definition at line 90 of file NiceCluster.cc.
Referenced by oversim::Nice::cleanPeers(), oversim::Nice::gracefulLeave(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceRemove(), and oversim::Nice::Remove().
void NiceCluster::setLastLT | ( | ) |
Definition at line 140 of file NiceCluster.cc.
Referenced by oversim::Nice::handleNiceLeaderTransfer().
void NiceCluster::setLeader | ( | const TransportAddress & | leader | ) |
Set leader to given address.
If leader is not in cluster, throws a cRuntimeError. The new leader is unconfirmed, call confirmLeader(), when we are sure that the leader info is correct.
Definition at line 101 of file NiceCluster.cc.
Referenced by oversim::Nice::changeState(), clear(), oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), oversim::Nice::gracefulLeave(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::handleNiceQuery(), oversim::Nice::JoinCluster(), oversim::Nice::maintenance(), NiceCluster(), and remove().
void NiceCluster::setLeaderHeartbeatsSent | ( | int | heartbeats | ) |
Definition at line 162 of file NiceCluster.cc.
|
private |
Definition at line 36 of file NiceCluster.h.
Referenced by add(), begin(), clear(), contains(), end(), get(), getSize(), NiceCluster(), and remove().
|
private |
Definition at line 42 of file NiceCluster.h.
Referenced by clear(), getLastLT(), NiceCluster(), and setLastLT().
|
private |
Definition at line 39 of file NiceCluster.h.
Referenced by getLeader(), NiceCluster(), remove(), and setLeader().
|
private |
Definition at line 45 of file NiceCluster.h.
Referenced by confirmLeader(), isLeaderConfirmed(), NiceCluster(), and setLeader().
|
private |
Definition at line 48 of file NiceCluster.h.
Referenced by getLeaderHeartbeatsSent(), NiceCluster(), and setLeaderHeartbeatsSent().