Class IterativeSearchJob
java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.FloodSearchJob
net.i2p.router.networkdb.kademlia.IterativeSearchJob
- All Implemented Interfaces:
Job
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.
Public only for JobQueue, not a public API, not for external use.
- Since:
- 0.8.9
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanonly on fast boxes, for nowstatic final StringFields inherited from class net.i2p.router.networkdb.kademlia.FloodSearchJob
_created, _dead, _expiration, _facade, _isLease, _key, _log, _lookupsRemaining, _onFailed, _onFind, _success, _timeoutMs, CONCURRENT_SEARCHES -
Constructor Summary
ConstructorsConstructorDescriptionIterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease) Lookup using exploratory tunnelsIterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease, Hash fromLocalDest) Lookup using the client's tunnels. -
Method Summary
Modifier and TypeMethodDescriptionvoiddropped()Dropped by the job queue(package private) voidfailed()Total failure(package private) voidNote that the peer did not respond with a DSM (either a DSRM, timeout, or failure).Hash of the dest this query is fromgetName()Deprecated, unused, see FOSJ override(package private) voidnewPeerToTry(Hash peer) A new (floodfill) peer was discovered that may have the answer.voidrunJob()Deprecated, unused, see FOSJ override(package private) voidsuccess()Deprecated, unused, see FOSJ override(package private) longWhen did we send the query to the peer?booleanwasQueried(Hash peer) Did we send a request to this peer?Methods inherited from class net.i2p.router.networkdb.kademlia.FloodSearchJob
addDeferred, decrementRemaining, getCreated, getExpiration, getKey, getLookupsRemainingMethods inherited from class net.i2p.router.JobImpl
getAddedBy, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, madeReady, requeue, toString
-
Field Details
-
PROP_ENCRYPT_RI
- See Also:
-
DEFAULT_ENCRYPT_RI
public static final boolean DEFAULT_ENCRYPT_RIonly on fast boxes, for now
-
-
Constructor Details
-
IterativeSearchJob
public IterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease) Lookup using exploratory tunnels -
IterativeSearchJob
public IterativeSearchJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade, Hash key, Job onFind, Job onFailed, int timeoutMs, boolean isLease, Hash fromLocalDest) Lookup using the client's tunnels. Do not use for RI lookups down client tunnels, as the response will be dropped in InboundMessageDistributor.- Parameters:
fromLocalDest- use these tunnels for the lookup, or null for exploratory- Since:
- 0.9.10
-
-
Method Details
-
runJob
public void runJob()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override- Specified by:
runJobin interfaceJob- Overrides:
runJobin classFloodSearchJob
-
getName
Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override- Specified by:
getNamein interfaceJob- Overrides:
getNamein classFloodSearchJob
-
failed
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
A new (floodfill) peer was discovered that may have the answer.- Parameters:
peer- may not actually be new
-
getFromHash
Hash of the dest this query is from- Returns:
- null for router
- Since:
- 0.9.13
-
wasQueried
Did we send a request to this peer?- Since:
- 0.9.13
-
timeSent
When did we send the query to the peer?- Returns:
- context time, or -1 if never sent
-
dropped
public void dropped()Dropped by the job queue -
failed
void failed()Total failure- Overrides:
failedin classFloodSearchJob
-
success
void success()Description copied from class:FloodSearchJobDeprecated, unused, see FOSJ override- Overrides:
successin classFloodSearchJob
-