#include <ChordFingerTable.h>
This modul contains the finger table of the Chord implementation.
Public Member Functions | |
virtual int | numInitStages () const |
virtual void | initialize (int stage) |
virtual void | handleMessage (cMessage *msg) |
virtual void | initializeTable (uint size, NodeHandle owner) |
Sets up the finger table. | |
virtual void | setFinger (uint pos, NodeHandle node) |
Sets a particular finger to point to node. | |
virtual const NodeHandle & | getFinger (uint pos) |
Returns the NodeHandle of a particular finger. | |
virtual uint | getSize () |
Returns the size of the finger table. | |
Protected Attributes | |
std::vector< NodeHandle > | fingerTable |
the finger table vector |
const NodeHandle & ChordFingerTable::getFinger | ( | uint | pos | ) | [virtual] |
Returns the NodeHandle of a particular finger.
pos | number of the finger to get |
00070 { 00071 if (pos >= fingerTable.size()) 00072 error("Index out of bound (ChordFingerTable, getFinger())"); 00073 00074 return fingerTable[pos]; 00075 }
uint ChordFingerTable::getSize | ( | ) | [virtual] |
Returns the size of the finger table.
00056 { 00057 return fingerTable.size(); 00058 }
void ChordFingerTable::handleMessage | ( | cMessage * | msg | ) | [virtual] |
void ChordFingerTable::initialize | ( | int | stage | ) | [virtual] |
00036 { 00037 // because of IPAddressResolver, we need to wait until interfaces 00038 // are registered, address auto-assignment takes place etc. 00039 if(stage != MIN_STAGE_OVERLAY) 00040 return; 00041 00042 WATCH_VECTOR(fingerTable); 00043 }
void ChordFingerTable::initializeTable | ( | uint | size, | |
NodeHandle | owner | |||
) | [virtual] |
Sets up the finger table.
Sets up the finger table and makes all fingers pointing to the node itself. Should be called on startup to initialize the finger table.
size | number of fingers | |
owner | set all fingers to the key of node handle owner |
00051 { 00052 fingerTable.assign(size, owner); 00053 }
virtual int ChordFingerTable::numInitStages | ( | ) | const [inline, virtual] |
void ChordFingerTable::setFinger | ( | uint | pos, | |
NodeHandle | node | |||
) | [virtual] |
Sets a particular finger to point to node.
pos | number of the finger to set | |
node | set finger to this node |
00061 { 00062 if (pos < fingerTable.size()) { 00063 fingerTable[pos] = node; 00064 } else { 00065 error("Index out of bound (ChordFingerTable, setFinger())"); 00066 } 00067 }
std::vector<NodeHandle> ChordFingerTable::fingerTable [protected] |
the finger table vector