Chord's successor list module.
More...
#include <ChordSuccessorList.h>
Detailed Description
Chord's successor list module.
This modul contains the successor list of the Chord implementation.
- Author
- Markus Mauch, Ingmar Baumgart
- See Also
- Chord
Definition at line 58 of file ChordSuccessorList.h.
Member Function Documentation
void oversim::ChordSuccessorList::addSuccessor |
( |
NodeHandle |
successor, |
|
|
bool |
resize = true |
|
) |
| |
|
virtual |
Adds new successor nodes to the successor list.
Adds new successor nodes to the successor list and sorts the list using the corresponding chord keys. If the list size exceeds the maximum size nodes at the end of the list will be removed.
- Parameters
-
successor | the node handle of the successor to be added |
resize | if true, shrink the list to successorListSize |
Definition at line 122 of file ChordSuccessorList.cc.
{
std::map<OverlayKey, SuccessorListEntry>::iterator it =
} else {
}
SuccessorListEntry entry;
entry.nodeHandle = successor;
entry.newEntry = true;
it--;
}
}
void oversim::ChordSuccessorList::display |
( |
| ) |
|
Definition at line 233 of file ChordSuccessorList.cc.
{
cout << "Content of ChordSuccessorList:" << endl;
for (std::map<OverlayKey,SuccessorListEntry>::iterator it =
cout << it->first << " with Node: " << it->second.nodeHandle << endl;
}
uint32_t oversim::ChordSuccessorList::getSize |
( |
| ) |
|
|
virtual |
Returns number of neighbors in the successor list.
- Returns
- number of neighbors
Definition at line 67 of file ChordSuccessorList.cc.
const NodeHandle & oversim::ChordSuccessorList::getSuccessor |
( |
uint32_t |
pos = 0 | ) |
|
|
virtual |
Returns a particular successor.
- Parameters
-
pos | position in the successor list |
- Returns
- successor at position pos
Definition at line 80 of file ChordSuccessorList.cc.
{
error(
"Index out of bound (ChordSuccessorList, getSuccessor())");
}
std::map<OverlayKey, SuccessorListEntry>::iterator it =
for (uint32_t i= 0; i < pos; i++) {
it++;
if (i == (pos-1))
return it->second.nodeHandle;
}
return it->second.nodeHandle;
}
bool oversim::ChordSuccessorList::handleFailedNode |
( |
const TransportAddress & |
failed | ) |
|
Definition at line 153 of file ChordSuccessorList.cc.
{
for (std::map<OverlayKey, SuccessorListEntry>::iterator iter =
if (failed == iter->second.nodeHandle) {
return true;
}
}
return false;
}
void oversim::ChordSuccessorList::handleMessage |
( |
cMessage * |
msg | ) |
|
|
virtual |
void oversim::ChordSuccessorList::initialize |
( |
int |
stage | ) |
|
|
virtual |
void oversim::ChordSuccessorList::initializeList |
( |
uint32_t |
size, |
|
|
NodeHandle |
owner, |
|
|
Chord * |
overlay |
|
) |
| |
|
virtual |
Initializes the successor list.
This should be called on startup
- Parameters
-
size | maximum number of neighbors in the successor list |
owner | the node owner is added to the successor list |
overlay | pointer to the main chord module |
Definition at line 57 of file ChordSuccessorList.cc.
Referenced by oversim::Koorde::initializeFriendModules().
bool oversim::ChordSuccessorList::isEmpty |
( |
| ) |
|
|
virtual |
Checks if the successor list is empty.
- Returns
- returns false if the successor list contains other nodes than this node, true otherwise.
Definition at line 72 of file ChordSuccessorList.cc.
{
return true;
else
return false;
}
virtual int oversim::ChordSuccessorList::numInitStages |
( |
| ) |
const |
|
inlinevirtual |
void oversim::ChordSuccessorList::removeOldSuccessors |
( |
| ) |
|
|
protected |
Definition at line 170 of file ChordSuccessorList.cc.
{
std::map<OverlayKey,SuccessorListEntry>::iterator it;
if (it->second.newEntry == false) {
} else {
it->second.newEntry = false;
it++;
}
}
it--;
}
}
void oversim::ChordSuccessorList::updateDisplayString |
( |
| ) |
|
|
protected |
Displays the current number of successors in the list.
Definition at line 197 of file ChordSuccessorList.cc.
{
if (1) {
char buf[80];
sprintf(buf, "1 successor");
} else {
}
getDisplayString().setTagArg("t", 0, buf);
getDisplayString().setTagArg("t", 2, "blue");
}
}
void oversim::ChordSuccessorList::updateList |
( |
NotifyResponse * |
notify | ) |
|
|
virtual |
Definition at line 101 of file ChordSuccessorList.cc.
{
for (uint32_t k = 0; ((k < static_cast<uint32_t>(notifyResponse->getSucNum()))
NodeHandle successor = notifyResponse->getSucNode(k);
notifyResponse->getSrcNode().getKey()))
continue;
}
}
void oversim::ChordSuccessorList::updateTooltip |
( |
| ) |
|
|
protected |
Displays the first 4 successor nodes as tooltip.
Definition at line 216 of file ChordSuccessorList.cc.
{
if (ev.isGUI()) {
std::stringstream str;
str << endl;
}
char buf[1024];
sprintf(buf, "%s", str.str().c_str());
getDisplayString().setTagArg("tt", 0, buf);
}
}
Member Data Documentation
Chord* oversim::ChordSuccessorList::overlay |
|
protected |
uint32_t oversim::ChordSuccessorList::successorListSize |
|
protected |
The documentation for this class was generated from the following files: