#include <IterativeLookup.h>

It uses the standard metric for greedy behaviour. If another metric is needed, the distance function can be replaced by overriding the distance method.
Definition at line 80 of file IterativeLookup.h.
Public Member Functions | |
| IterativeLookup (BaseOverlay *overlay, RoutingType routingType, const IterativeLookupConfiguration &config, const cObject *findNodeExt=NULL, bool appLookup=false) | |
| virtual | ~IterativeLookup () |
| void | lookup (const OverlayKey &key, int numSiblings=1, int hopCountMax=0, int retries=0, LookupListener *listener=NULL) |
| Lookup siblings for a key. | |
| const NodeVector & | getResult () const |
| Returns the result of the lookup. | |
| bool | isValid () const |
| Returns true, if the lookup was successful. | |
| void | abortLookup () |
| Aborts a running lookup. | |
| uint32_t | getAccumulatedHops () const |
| Returns the total number of hops for all lookup paths. | |
Protected Types | |
| typedef UNORDERED_MAP < TransportAddress, RpcInfoVector, TransportAddress::hashFcn > | RpcInfoMap |
Protected Member Functions | |
| virtual IterativePathLookup * | createPathLookup () |
| This method creates a new path lookup. | |
| virtual FindNodeCall * | createInitialRpcCall () |
| This method creates the initial FindNode RPC call message used to query the local findNode() method. | |
| int | compare (const OverlayKey &lhs, const OverlayKey &rhs) const |
| compares two OverlayKeys and indicates which one is closer to the key to look up | |
| bool | addSibling (const NodeHandle &handle) |
| adds a node to the siblings NodeVector | |
| void | setVisited (const TransportAddress &addr, bool visitedFlag=true) |
| adds/deletes visited nodes to/from the visited TransportAddress::Set | |
| bool | getVisited (const TransportAddress &addr) |
| indicates if the specified node has been visited before | |
| void | setDead (const TransportAddress &addr) |
| add a dead node to the dead node list | |
| bool | getDead (const TransportAddress &addr) |
| check if a node seems to be dead | |
| void | handleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt) |
| This method is called if an RPC response has been received. | |
| void | handleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey=OverlayKey::UNSPECIFIED_KEY) |
| This method is called if an RPC timeout has been reached. | |
| void | sendRpc (const NodeHandle &handle, FindNodeCall *call, IterativePathLookup *listener, int rpcId) |
| void | start () |
| void | stop () |
| void | checkStop () |
Protected Attributes | |
| OverlayKey | key |
| key to lookup | |
| BaseOverlay * | overlay |
| ptr to overlay | |
| LookupListener * | listener |
| lookup listener | |
| std::vector < IterativePathLookup * > | paths |
| parallel paths | |
| RoutingType | routingType |
| RoutingType for this lookup. | |
| IterativeLookupConfiguration | config |
| lookup configuration | |
| cObject * | firstCallExt |
| additional info for first findNode() | |
| uint32_t | finishedPaths |
| number of finished paths | |
| uint32_t | successfulPaths |
| number of successful paths | |
| uint32_t | accumulatedHops |
| total number of hops (for all paths) | |
| bool | finished |
| true, if lookup is finished | |
| bool | success |
| true, if lookup was successful | |
| bool | running |
| true, if lookup is running | |
| int | retries |
| number of retries, if lookup fails | |
| bool | appLookup |
| NodeVector | siblings |
| closest nodes | |
| TransportAddress::Set | visited |
| nodes already visited | |
| TransportAddress::Set | dead |
| nodes which seem to be dead | |
| int | numSiblings |
| number of siblings | |
| int | hopCountMax |
| maximum hop count | |
| RpcInfoMap | rpcs |
Friends | |
| class | IterativePathLookup |
| class | BaseOverlay |
Classes | |
| class | RpcInfo |
| class | RpcInfoVector |
typedef UNORDERED_MAP<TransportAddress, RpcInfoVector, TransportAddress::hashFcn> IterativeLookup::RpcInfoMap [protected] |
Definition at line 206 of file IterativeLookup.h.
| IterativeLookup::IterativeLookup | ( | BaseOverlay * | overlay, | |
| RoutingType | routingType, | |||
| const IterativeLookupConfiguration & | config, | |||
| const cObject * | findNodeExt = NULL, |
|||
| bool | appLookup = false | |||
| ) |
Definition at line 69 of file IterativeLookup.cc.
00073 : 00074 overlay(overlay), 00075 routingType(routingType), 00076 config(config), 00077 firstCallExt(NULL), 00078 finished(false), 00079 success(false), 00080 running(false), 00081 appLookup(appLookup) 00082 { 00083 if (findNodeExt) firstCallExt = static_cast<cObject*>(findNodeExt->dup()); 00084 00085 if (config.secure) { 00086 throw cRuntimeError("IterativeLookup::IterativeLookup(): " 00087 "Secure IterativeLookup not implemented yet!"); 00088 } 00089 00090 if ((config.parallelPaths > 1) && (!config.merge)) { 00091 throw cRuntimeError("IterativeLookup::IterativeLookup(): " 00092 "config.merge must be enabled for " 00093 "using parallel paths!"); 00094 } 00095 00096 if ((config.useAllParallelResponses) && (!config.merge)) { 00097 throw cRuntimeError("IterativeLookup::IterativeLookup(): " 00098 "config.merge must be enabled if " 00099 "config.useAllParallelResponses is true!"); 00100 } 00101 }
| IterativeLookup::~IterativeLookup | ( | ) | [virtual] |
Definition at line 103 of file IterativeLookup.cc.
00104 { 00105 stop(); 00106 delete firstCallExt; 00107 overlay->removeLookup(this); 00108 00109 // std::cout << "time: " << simTime() << "deleting " << this << endl; 00110 }
| IterativePathLookup * IterativeLookup::createPathLookup | ( | ) | [protected, virtual] |
This method creates a new path lookup.
It may be overloaded to enhance IterativePathLookup with some new information/features.
Definition at line 296 of file IterativeLookup.cc.
00297 { 00298 return new IterativePathLookup(this); 00299 }
| FindNodeCall * IterativeLookup::createInitialRpcCall | ( | ) | [protected, virtual] |
This method creates the initial FindNode RPC call message used to query the local findNode() method.
It may be overridden to allow additional information being attached before the lookup procedure actually starts
Definition at line 301 of file IterativeLookup.cc.
Referenced by start().
00302 { 00303 FindNodeCall* call = new FindNodeCall("FindNodeCall"); 00304 if (appLookup) { 00305 call->setStatType(APP_LOOKUP_STAT); 00306 } else { 00307 call->setStatType(MAINTENANCE_STAT); 00308 } 00309 00310 if (firstCallExt) { 00311 call->addObject(static_cast<cObject*>(firstCallExt->dup())); 00312 } 00313 00314 return call; 00315 }
| int IterativeLookup::compare | ( | const OverlayKey & | lhs, | |
| const OverlayKey & | rhs | |||
| ) | const [protected, virtual] |
compares two OverlayKeys and indicates which one is closer to the key to look up
| lhs | the first OverlayKey | |
| rhs | the second OverlayKey |
Reimplemented from Comparator< OverlayKey >.
Definition at line 321 of file IterativeLookup.cc.
| bool IterativeLookup::addSibling | ( | const NodeHandle & | handle | ) | [protected] |
adds a node to the siblings NodeVector
| handle | NodeHandle of the node to add |
Definition at line 330 of file IterativeLookup.cc.
Referenced by IterativePathLookup::handleResponse(), IterativePathLookup::sendRpc(), and start().
00331 { 00332 bool result = false; 00333 00334 if (numSiblings == 0) { 00335 if (handle.key == key) { 00336 siblings.clear(); 00337 siblings.push_back( handle ); 00338 result = true; 00339 } 00340 } else { 00341 if (config.parallelPaths == 1) { 00342 result = true; 00343 if (!siblings.isFull()) { 00344 siblings.push_back(handle); 00345 } 00346 } else { 00347 if (this->siblings.add(handle) >= 0) { 00348 result = true; 00349 } 00350 } 00351 } 00352 00353 return result; 00354 }
| void IterativeLookup::setVisited | ( | const TransportAddress & | addr, | |
| bool | visitedFlag = true | |||
| ) | [protected] |
adds/deletes visited nodes to/from the visited TransportAddress::Set
| addr | TransportAddress of the node to add | |
| visitedFlag | if true node is added, else node is erased |
Definition at line 356 of file IterativeLookup.cc.
Referenced by IterativePathLookup::handleFailedNodeResponse(), IterativePathLookup::handleResponse(), and start().
00357 { 00358 if (visitedFlag) 00359 this->visited.insert(addr); 00360 else 00361 this->visited.erase(addr); 00362 }
| bool IterativeLookup::getVisited | ( | const TransportAddress & | addr | ) | [protected] |
indicates if the specified node has been visited before
| addr | TransportAddress of the node |
Definition at line 364 of file IterativeLookup.cc.
Referenced by IterativePathLookup::sendRpc().
00365 { 00366 return (visited.count(addr) != 0); 00367 }
| void IterativeLookup::setDead | ( | const TransportAddress & | addr | ) | [protected] |
add a dead node to the dead node list
| addr | TransportAddress of the node to add |
Definition at line 369 of file IterativeLookup.cc.
Referenced by handleRpcTimeout().
00370 { 00371 dead.insert(addr); 00372 }
| bool IterativeLookup::getDead | ( | const TransportAddress & | addr | ) | [protected] |
check if a node seems to be dead
| addr | TransportAddress of the node |
Definition at line 374 of file IterativeLookup.cc.
Referenced by IterativePathLookup::handleTimeout(), and IterativePathLookup::sendRpc().
00375 { 00376 return (dead.count(addr) != 0); 00377 }
| void IterativeLookup::handleRpcResponse | ( | BaseResponseMessage * | msg, | |
| cPolymorphic * | context, | |||
| int | rpcId, | |||
| simtime_t | rtt | |||
| ) | [protected, virtual] |
This method is called if an RPC response has been received.
| msg | The response message. | |
| context | Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code | |
| rpcId | The RPC id. | |
| rtt | The Round-Trip-Time of this RPC |
Reimplemented from RpcListener.
Definition at line 384 of file IterativeLookup.cc.
00387 { 00388 // check flags 00389 if (finished || !running) 00390 return; 00391 00392 // get source, cast messages and mark node as visited 00393 const TransportAddress& src = msg->getSrcNode(); 00394 FindNodeResponse* findNodeResponse = dynamic_cast<FindNodeResponse*>(msg); 00395 PingResponse* pingResponse = dynamic_cast<PingResponse*>(msg); 00396 FailedNodeResponse* failedNodeResponse = 00397 dynamic_cast<FailedNodeResponse*>(msg); 00398 00399 if (findNodeResponse != NULL || pingResponse != NULL) { 00400 // add authentificated sibling 00401 // addSibling( src ); 00402 } 00403 00404 // handle find node response 00405 if (findNodeResponse != NULL) { 00406 // std::cout << "time: " << simTime() << " node: " << overlay->thisNode << " this: " << this << " received rpc with nonce: " << findNodeResponse->getNonce() << " from: " << findNodeResponse->getSrcNode() << endl; 00407 00408 // check if rpc info is available, no -> exit 00409 if (rpcs.count(src) == 0) 00410 return; 00411 00412 // get info 00413 RpcInfoVector infos = rpcs[src]; 00414 rpcs.erase(src); 00415 00416 // add to siblinglist if not secure 00417 // if (!config.secure) 00418 // for (uint i=0; i<findNodeResponse->getClosestNodesArraySize(); i++) 00419 // addSibling( findNodeResponse->getClosestNodes(i) ); 00420 00421 // iterate 00422 bool rpcHandled = false; 00423 00424 for (uint32_t i=0; i<infos.size(); i++) { 00425 // get info 00426 const RpcInfo& info = infos[i]; 00427 00428 // do not handle finished paths 00429 if (info.path->finished) 00430 continue; 00431 00432 // check if path accepts the message 00433 // make an exception for responses with siblings==true 00434 if (!rpcHandled && 00435 (info.path->accepts(info.vrpcId) || 00436 ((routingType == EXHAUSTIVE_ITERATIVE_ROUTING) 00437 || findNodeResponse->getSiblings()))) { 00438 info.path->handleResponse(findNodeResponse); 00439 rpcHandled = true; 00440 } else { 00441 EV << "[IterativeLookup::handleRpcResponse()]\n" 00442 << " Path does not accept message with id " << info.vrpcId 00443 << endl; 00444 00445 info.path->handleTimeout(NULL, findNodeResponse->getSrcNode(), 00446 info.vrpcId); 00447 } 00448 00449 // count finished and successful paths 00450 if (info.path->finished) { 00451 finishedPaths++; 00452 00453 // count total number of hops 00454 accumulatedHops += info.path->hops; 00455 00456 if (info.path->success) 00457 successfulPaths++; 00458 } 00459 00460 } 00461 } 00462 00463 00464 // handle failed node response 00465 if (failedNodeResponse != NULL) { 00466 cPacket* findNodeExt = NULL; 00467 if (failedNodeResponse->hasObject("findNodeExt")) { 00468 findNodeExt = 00469 (cPacket*)failedNodeResponse->removeObject("findNodeExt"); 00470 } 00471 00472 for (std::vector<IterativePathLookup*>::iterator i = paths.begin(); 00473 i != paths.end(); i++) { 00474 00475 (*i)->handleFailedNodeResponse(failedNodeResponse->getSrcNode(), 00476 findNodeExt, 00477 failedNodeResponse->getTryAgain()); 00478 } 00479 } 00480 00481 checkStop(); 00482 }
| void IterativeLookup::handleRpcTimeout | ( | BaseCallMessage * | msg, | |
| const TransportAddress & | dest, | |||
| cPolymorphic * | context, | |||
| int | rpcId, | |||
| const OverlayKey & | destKey = OverlayKey::UNSPECIFIED_KEY | |||
| ) | [protected, virtual] |
This method is called if an RPC timeout has been reached.
| msg | The original RPC message. | |
| dest | The destination node | |
| context | Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code | |
| rpcId | The RPC id. | |
| destKey | the destination OverlayKey |
Reimplemented from RpcListener.
Definition at line 485 of file IterativeLookup.cc.
00489 { 00490 // check flags 00491 if (finished || !running) 00492 return; 00493 00494 // check if rpc info is available 00495 if (rpcs.count(dest)==0) { 00496 cout << "IterativeLookup::handleRpcTimeout(): RPC Timeout, but node" 00497 << " is not in rpcs structure!" << endl; 00498 return; 00499 } 00500 00501 // mark the node as dead 00502 setDead(dest); 00503 00504 RpcInfoVector infos = rpcs[dest]; 00505 rpcs.erase(dest); 00506 00507 // iterate 00508 for (uint32_t i=0; i < infos.size(); i++) { 00509 00510 const RpcInfo& info = infos[i]; 00511 00512 // do not handle finished paths 00513 if (info.path->finished) 00514 continue; 00515 00516 // delegate timeout 00517 info.path->handleTimeout(msg, dest, info.vrpcId); 00518 00519 // count total number of hops 00520 accumulatedHops += info.path->hops; 00521 00522 // count finished and successful paths 00523 if (info.path->finished) { 00524 finishedPaths++; 00525 if (info.path->success) 00526 successfulPaths++; 00527 } 00528 } 00529 checkStop(); 00530 }
| void IterativeLookup::sendRpc | ( | const NodeHandle & | handle, | |
| FindNodeCall * | call, | |||
| IterativePathLookup * | listener, | |||
| int | rpcId | |||
| ) | [protected] |
Definition at line 532 of file IterativeLookup.cc.
Referenced by IterativePathLookup::sendRpc().
00534 { 00535 // check flags 00536 if (finished || !running) { 00537 delete call; 00538 return; 00539 } 00540 00541 // create rpc info 00542 RpcInfo info; 00543 info.path = listener; 00544 info.vrpcId = rpcId; 00545 00546 // send new message 00547 if (rpcs.count(handle) == 0) { 00548 RpcInfoVector newVector; 00549 00550 overlay->countFindNodeCall(call); 00551 newVector.nonce = overlay->sendUdpRpcCall(handle, call, NULL, 00552 -1, 0, -1, this); 00553 00554 // std::cout << "time: " << simTime() << " node: " << overlay->thisNode << " new rpc with nonce: " << newVector.nonce << " to: " << handle << endl; 00555 rpcs[handle] = newVector; 00556 } else { 00557 EV << "[IterativeLookup::sendRpc()]\n" 00558 << " RPC already sent...not sent again" 00559 << endl; 00560 delete call; 00561 } 00562 00563 // register info 00564 rpcs[handle].push_back(info); 00565 }
| void IterativeLookup::start | ( | ) | [protected] |
Definition at line 121 of file IterativeLookup.cc.
Referenced by checkStop(), and lookup().
00122 { 00123 // std::cout << "time: " << simTime() << " start(): node: " << overlay->getThisNode() << " this: " << this << " key: " << key << endl; 00124 00125 // init params 00126 successfulPaths = 0; 00127 finishedPaths = 0; 00128 accumulatedHops = 0; 00129 00130 // init flags 00131 finished = false; 00132 success = false; 00133 running = true; 00134 00135 // init siblings vector 00136 siblings = NodeVector(numSiblings == 0 ? 1 : numSiblings, this); 00137 visited.clear(); 00138 dead.clear(); 00139 00140 // get local closest nodes 00141 FindNodeCall* call = createInitialRpcCall(); 00142 NodeVector* nextHops = overlay->findNode(key, config.redundantNodes, 00143 numSiblings, call); 00144 bool err; 00145 00146 setVisited(overlay->getThisNode()); 00147 00148 // if this node is new and no nodes are known -> stop lookup 00149 if (nextHops->size() == 0) { 00150 //std::cout << "IterativeLookup: No next hops known" << endl; 00151 finished = true; 00152 success = false; 00153 } else if ((numSiblings == 0) 00154 && overlay->isSiblingFor(overlay->getThisNode(), 00155 key, numSiblings, 00156 &err)) { 00157 if (overlay->getThisNode().key == key) { 00158 addSibling(overlay->getThisNode()); 00159 success = true; 00160 } else { 00161 std::cout << "IterativeLookup: numSiblings==0 and no node with this id" 00162 << endl; 00163 success = false; 00164 } 00165 finished = true; 00166 } 00167 // finish lookup if the key is local and siblings are needed 00168 else if (numSiblings != 0 && 00169 overlay->isSiblingFor(overlay->getThisNode(), key, 00170 numSiblings, &err) 00171 && !config.secure) { 00172 00173 for (uint32_t i=0; i<nextHops->size(); i++) { 00174 addSibling(nextHops->at(i)); 00175 } 00176 00177 success = finished = true; 00178 } 00179 00180 // if the key was local or belongs to one of our siblings we are finished 00181 if (finished) { 00182 // calls stop and finishes the lookup 00183 delete nextHops; 00184 delete call; 00185 delete this; 00186 return; 00187 } 00188 00189 // extract find node extensions 00190 cPacket* findNodeExt = NULL; 00191 if (call->hasObject("findNodeExt")) 00192 findNodeExt = (cPacket*)call->removeObject("findNodeExt"); 00193 delete call; 00194 00195 // not enough nodes for all paths? -> reduce number of parallel paths 00196 if ((uint32_t)config.parallelPaths > nextHops->size()) { 00197 config.parallelPaths = nextHops->size(); 00198 } 00199 00200 // create parallel paths and distribute nodes to paths 00201 for (int i = 0; i < config.parallelPaths; i++) { 00202 00203 // create state 00204 IterativePathLookup* pathLookup = new IterativePathLookup(this); 00205 paths.push_back(pathLookup); 00206 00207 // populate next hops 00208 for (uint32_t k=0; (k * config.parallelPaths + i) < nextHops->size(); k++) { 00209 pathLookup->add(nextHops->at(k * config.parallelPaths + i)); 00210 } 00211 00212 // send initial rpcs 00213 pathLookup->sendRpc(config.parallelRpcs, findNodeExt); 00214 } 00215 00216 00217 //std::cout << "nextHops size: " << nextHops->size() 00218 //<< " numSiblings: " << numSiblings 00219 //<< " redundantNodes: " << config.redundantNodes 00220 //<< " thisNode " << overlay->getThisNode().ip 00221 //<< " nextHop " << nextHops->at(0).ip << endl; 00222 00223 delete nextHops; 00224 delete findNodeExt; 00225 00226 checkStop(); 00227 }
| void IterativeLookup::stop | ( | ) | [protected] |
Definition at line 229 of file IterativeLookup.cc.
Referenced by checkStop(), and ~IterativeLookup().
00230 { 00231 // only stop if running 00232 if (!running) 00233 return; 00234 00235 // cancel pending rpcs 00236 for (RpcInfoMap::iterator i = rpcs.begin(); i != rpcs.end(); i++) { 00237 // std::cout << "time: " << simTime() << " node: " << overlay->thisNode << " this: " << this << " first: " << i->first << " nonce: " << i->second.nonce << endl; 00238 overlay->cancelRpcMessage(i->second.nonce); 00239 } 00240 rpcs.clear(); 00241 00242 // delete path lookups 00243 for (uint32_t i=0; i<paths.size(); i++) { 00244 delete paths[i]; 00245 } 00246 paths.clear(); 00247 00248 // reset running flag 00249 running = false; 00250 finished = true; 00251 00252 // inform listener 00253 if (listener != NULL) { 00254 listener->lookupFinished(this); 00255 listener = NULL; 00256 } 00257 }
| void IterativeLookup::checkStop | ( | ) | [inline, protected] |
Definition at line 259 of file IterativeLookup.cc.
Referenced by handleRpcResponse(), handleRpcTimeout(), and start().
00260 { 00261 bool finishLookup = false; 00262 00263 // check if there are rpcs pending or lookup finished 00264 if ((successfulPaths >= 1 && numSiblings == 0) || 00265 (finishedPaths == (uint32_t)config.parallelPaths && numSiblings > 0)) { 00266 for (uint32_t i=0; i<paths.size(); i++) 00267 success |= paths[i]->success; 00268 finishLookup = true; 00269 } else if (rpcs.size() == 0) { 00270 finishLookup = true; 00271 } 00272 00273 if (finishLookup == true) { 00274 00275 if (success == false) { 00276 //cout << "failed: hops :" << accumulatedHops << endl; 00277 } 00278 00279 if (success == false && retries > 0) { 00280 // std::cout << "IterativeLookup::checkStop(): Retry..." << endl; 00281 retries--; 00282 LookupListener* oldListener = listener; 00283 listener = NULL; 00284 stop(); 00285 listener = oldListener; 00286 start(); 00287 } else { 00288 delete this; 00289 } 00290 } 00291 }
| void IterativeLookup::lookup | ( | const OverlayKey & | key, | |
| int | numSiblings = 1, |
|||
| int | hopCountMax = 0, |
|||
| int | retries = 0, |
|||
| LookupListener * | listener = NULL | |||
| ) | [virtual] |
Lookup siblings for a key.
| key | The key to lookup | |
| numSiblings | Number of siblings to lookup | |
| hopCountMax | Maximum hop count | |
| retries | Number of retries if lookup fails | |
| listener | Listener to inform, when the lookup is done |
Implements AbstractLookup.
Definition at line 571 of file IterativeLookup.cc.
00573 { 00574 EV << "[IterativeLookup::lookup() @ " << overlay->overlay->getThisNode().ip 00575 << " (" << overlay->overlay->getThisNode().key.toString(16) << ")]\n" 00576 << " Lookup of key " << key 00577 << endl; 00578 00579 // check flags 00580 if (finished || running) 00581 return; 00582 00583 // set params 00584 this->key = key; 00585 this->numSiblings = numSiblings; 00586 this->hopCountMax = hopCountMax; 00587 this->listener = listener; 00588 this->retries = retries; 00589 00590 if ((routingType == EXHAUSTIVE_ITERATIVE_ROUTING) 00591 && (numSiblings > config.redundantNodes)) { 00592 throw cRuntimeError("IterativeLookup::lookup(): " 00593 "With EXHAUSTIVE_ITERATIVE_ROUTING numRedundantNodes " 00594 "must be >= numSiblings!"); 00595 } 00596 00597 // start lookup 00598 start(); 00599 }
| const NodeVector & IterativeLookup::getResult | ( | ) | const [virtual] |
Returns the result of the lookup.
Implements AbstractLookup.
Definition at line 601 of file IterativeLookup.cc.
00602 { 00603 // return sibling vector 00604 return siblings; 00605 }
| bool IterativeLookup::isValid | ( | ) | const [virtual] |
Returns true, if the lookup was successful.
Implements AbstractLookup.
Definition at line 607 of file IterativeLookup.cc.
| void IterativeLookup::abortLookup | ( | ) | [virtual] |
Aborts a running lookup.
This method aborts a running lookup without calling the listener and delete the lookup object.
Implements AbstractLookup.
Definition at line 112 of file IterativeLookup.cc.
00113 { 00114 if (listener != NULL) { 00115 delete listener; 00116 listener = NULL; 00117 } 00118 delete this; 00119 }
| uint32_t IterativeLookup::getAccumulatedHops | ( | ) | const [virtual] |
Returns the total number of hops for all lookup paths.
Implements AbstractLookup.
Definition at line 612 of file IterativeLookup.cc.
00613 { 00614 return accumulatedHops; 00615 }
friend class IterativePathLookup [friend] |
friend class BaseOverlay [friend] |
Definition at line 85 of file IterativeLookup.h.
OverlayKey IterativeLookup::key [protected] |
key to lookup
Definition at line 110 of file IterativeLookup.h.
Referenced by addSibling(), compare(), IterativePathLookup::createRpcMessage(), IterativePathLookup::handleResponse(), and start().
BaseOverlay* IterativeLookup::overlay [protected] |
ptr to overlay
Definition at line 111 of file IterativeLookup.h.
Referenced by compare(), IterativePathLookup::handleResponse(), IterativePathLookup::handleTimeout(), lookup(), sendRpc(), start(), stop(), and ~IterativeLookup().
LookupListener* IterativeLookup::listener [protected] |
lookup listener
Definition at line 112 of file IterativeLookup.h.
Referenced by abortLookup(), checkStop(), and stop().
std::vector<IterativePathLookup*> IterativeLookup::paths [protected] |
parallel paths
Definition at line 113 of file IterativeLookup.h.
Referenced by checkStop(), handleRpcResponse(), start(), and stop().
RoutingType IterativeLookup::routingType [protected] |
RoutingType for this lookup.
Definition at line 114 of file IterativeLookup.h.
Referenced by IterativePathLookup::handleResponse(), handleRpcResponse(), IterativePathLookup::handleTimeout(), IterativePathLookup::IterativePathLookup(), lookup(), and IterativePathLookup::sendRpc().
IterativeLookupConfiguration IterativeLookup::config [protected] |
lookup configuration
Definition at line 115 of file IterativeLookup.h.
Referenced by IterativePathLookup::accepts(), IterativePathLookup::add(), addSibling(), checkStop(), IterativePathLookup::createRpcMessage(), IterativePathLookup::handleResponse(), IterativePathLookup::handleTimeout(), IterativePathLookup::IterativePathLookup(), lookup(), IterativePathLookup::sendNewRpcAfterTimeout(), IterativePathLookup::sendRpc(), and start().
cObject* IterativeLookup::firstCallExt [protected] |
additional info for first findNode()
Definition at line 116 of file IterativeLookup.h.
Referenced by createInitialRpcCall(), IterativeLookup(), and ~IterativeLookup().
uint32_t IterativeLookup::finishedPaths [protected] |
number of finished paths
Definition at line 117 of file IterativeLookup.h.
Referenced by checkStop(), handleRpcResponse(), handleRpcTimeout(), and start().
uint32_t IterativeLookup::successfulPaths [protected] |
number of successful paths
Definition at line 118 of file IterativeLookup.h.
Referenced by checkStop(), handleRpcResponse(), handleRpcTimeout(), and start().
uint32_t IterativeLookup::accumulatedHops [protected] |
total number of hops (for all paths)
Definition at line 119 of file IterativeLookup.h.
Referenced by getAccumulatedHops(), handleRpcResponse(), handleRpcTimeout(), and start().
bool IterativeLookup::finished [protected] |
true, if lookup is finished
Definition at line 120 of file IterativeLookup.h.
Referenced by handleRpcResponse(), handleRpcTimeout(), isValid(), lookup(), sendRpc(), start(), and stop().
bool IterativeLookup::success [protected] |
true, if lookup was successful
Definition at line 121 of file IterativeLookup.h.
Referenced by checkStop(), isValid(), and start().
bool IterativeLookup::running [protected] |
true, if lookup is running
Definition at line 122 of file IterativeLookup.h.
Referenced by handleRpcResponse(), handleRpcTimeout(), lookup(), sendRpc(), start(), and stop().
int IterativeLookup::retries [protected] |
number of retries, if lookup fails
Definition at line 123 of file IterativeLookup.h.
Referenced by checkStop().
bool IterativeLookup::appLookup [protected] |
Definition at line 124 of file IterativeLookup.h.
Referenced by createInitialRpcCall(), and IterativePathLookup::createRpcMessage().
NodeVector IterativeLookup::siblings [protected] |
closest nodes
Definition at line 142 of file IterativeLookup.h.
Referenced by addSibling(), getResult(), and start().
TransportAddress::Set IterativeLookup::visited [protected] |
nodes already visited
Definition at line 143 of file IterativeLookup.h.
Referenced by getVisited(), setVisited(), and start().
TransportAddress::Set IterativeLookup::dead [protected] |
int IterativeLookup::numSiblings [protected] |
number of siblings
Definition at line 145 of file IterativeLookup.h.
Referenced by addSibling(), checkStop(), IterativePathLookup::createRpcMessage(), IterativePathLookup::handleResponse(), IterativePathLookup::handleTimeout(), and start().
int IterativeLookup::hopCountMax [protected] |
maximum hop count
Definition at line 146 of file IterativeLookup.h.
Referenced by IterativePathLookup::sendRpc().
RpcInfoMap IterativeLookup::rpcs [protected] |
Definition at line 207 of file IterativeLookup.h.
Referenced by checkStop(), handleRpcResponse(), handleRpcTimeout(), sendRpc(), and stop().
1.5.5