net.i2p.router.networkdb.kademlia
Class IterativeSearchJob

java.lang.Object
  extended by net.i2p.router.JobImpl
      extended by net.i2p.router.networkdb.kademlia.FloodSearchJob
          extended by net.i2p.router.networkdb.kademlia.IterativeSearchJob
All Implemented Interfaces:
Job

 class IterativeSearchJob
extends FloodSearchJob

A traditional Kademlia search that continues to search when the initial lookup fails, by iteratively searching the closer-to-the-key peers returned by the query in a DSRM. Unlike traditional Kad, it doesn't stop when there are no closer keys, it keeps going until the timeout or max number of searches is reached. Differences from FloodOnlySearchJob: Chases peers in DSRM's immediately. FOSJ searches the two closest in parallel and then stops. There is no per-search timeout, only a total timeout. Here, we search one at a time, and must have a separate per-search timeout. Advantages: Much more robust than FOSJ, especially in a large network where not all floodfills are known. Longer total timeout. Halves search traffic for successful searches, as this doesn't do two sesarches in parallel like FOSJ does.

Since:
0.8.9

Field Summary
 
Fields inherited from class net.i2p.router.networkdb.kademlia.FloodSearchJob
_created, _dead, _expiration, _facade, _isLease, _key, _log, _lookupsRemaining, _onFailed, _onFind, _timeoutMs, CONCURRENT_SEARCHES
 
Constructor Summary
IterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease)
           
 
Method Summary
(package private)  void failed()
          Total failure
(package private)  void failed(Hash peer, boolean timedOut)
          Note that the peer did not respond with a DSM (either a DSRM, timeout, or failure).
 String getName()
          Deprecated, unused, see FOSJ override
(package private)  void newPeerToTry(Hash peer)
          A new (floodfill) peer was discovered that may have the answer.
 void runJob()
          Deprecated, unused, see FOSJ override
(package private)  void success()
          Deprecated, unused, see FOSJ override
(package private)  long timeSent(Hash peer)
          When did we send the query to the peer?
 
Methods inherited from class net.i2p.router.networkdb.kademlia.FloodSearchJob
addDeferred, decrementRemaining, getCreated, getExpiration, getKey, getLookupsRemaining
 
Methods inherited from class net.i2p.router.JobImpl
dropped, getAddedBy, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IterativeSearchJob

public IterativeSearchJob(RouterContext ctx,
                          FloodfillNetworkDatabaseFacade facade,
                          Hash key,
                          Job onFind,
                          Job onFailed,
                          int timeoutMs,
                          boolean isLease)
Method Detail

runJob

public void runJob()
Description copied from class: FloodSearchJob
Deprecated, unused, see FOSJ override

Specified by:
runJob in interface Job
Overrides:
runJob in class FloodSearchJob

getName

public String getName()
Description copied from class: FloodSearchJob
Deprecated, unused, see FOSJ override

Specified by:
getName in interface Job
Overrides:
getName in class FloodSearchJob

failed

void failed(Hash peer,
            boolean timedOut)
Note that the peer did not respond with a DSM (either a DSRM, timeout, or failure). This is not necessarily a total failure of the search.

Parameters:
timedOut - if true, will blame the peer's profile

newPeerToTry

void newPeerToTry(Hash peer)
A new (floodfill) peer was discovered that may have the answer.

Parameters:
peer - may not actually be new

timeSent

long timeSent(Hash peer)
When did we send the query to the peer?

Returns:
context time, or -1 if never sent

failed

void failed()
Total failure

Overrides:
failed in class FloodSearchJob

success

void success()
Description copied from class: FloodSearchJob
Deprecated, unused, see FOSJ override

Overrides:
success in class FloodSearchJob