|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.JobImpl
net.i2p.router.networkdb.kademlia.SearchJob
class SearchJob
Search for a particular key iteratively until we either find a value or we run out of peers
Nested Class Summary | |
---|---|
protected class |
SearchJob.FailedJob
Called when a particular peer failed to respond before the timeout was reached, or if the peer could not be contacted at all. |
Field Summary | |
---|---|
protected KademliaNetworkDatabaseFacade |
_facade
|
(package private) static int |
MAX_CLOSEST
only send the 10 closest "dont tell me about" refs |
(package private) static int |
PER_FLOODFILL_PEER_TIMEOUT
|
Constructor Summary | |
---|---|
SearchJob(RouterContext context,
KademliaNetworkDatabaseFacade facade,
Hash key,
Job onSuccess,
Job onFailure,
long timeoutMs,
boolean keepStats,
boolean isLease)
Create a new search for the routingKey specified |
Method Summary | |
---|---|
(package private) boolean |
add(Hash peer)
|
int |
addDeferred(Job onFind,
Job onFail,
long expiration,
boolean isLease)
|
protected DatabaseLookupMessage |
buildMessage(long expiration)
We're looking for a router, so lets build the lookup message (no need to tunnel route either, so just have replies sent back to us directly) |
protected DatabaseLookupMessage |
buildMessage(TunnelId replyTunnelId,
Hash replyGateway,
long expiration)
Build the database search message |
protected void |
continueSearch()
Send a series of searches to the next available peers as selected by the routing table, but making sure no more than SEARCH_BREDTH are outstanding at any time |
(package private) void |
decrementOutstandingFloodfillSearches()
|
protected void |
fail()
Search totally failed |
protected int |
getBredth()
max # of concurrent searches |
long |
getExpiration()
|
protected KademliaNetworkDatabaseFacade |
getFacade()
|
java.lang.String |
getName()
Descriptive name of the task |
protected int |
getPerPeerTimeoutMs()
Let each peer take up to the average successful search RTT |
protected int |
getPerPeerTimeoutMs(Hash peer)
|
protected SearchState |
getState()
|
long |
getTimeoutMs()
|
(package private) static boolean |
isCongested(RouterContext ctx)
|
protected void |
newPeersFound(int numNewPeers)
We've gotten a search reply that contained the specified number of peers that we didn't know about before. |
(package private) static boolean |
onlyQueryFloodfillPeers(RouterContext ctx)
|
(package private) void |
replyFound(DatabaseSearchReplyMessage message,
Hash peer)
|
void |
runJob()
Actually perform the task. |
protected void |
searchNext()
Send the next search, or stop if its completed |
protected void |
sendLeaseSearch(RouterInfo router)
we're (probably) searching for a LeaseSet, so to be (overly) cautious, we're sending the request out through a tunnel w/ reply back through another tunnel. |
protected void |
sendRouterSearch(RouterInfo router)
we're searching for a router, so we can just send direct |
protected void |
sendSearch(RouterInfo router)
Send a search to the given peer |
(package private) long |
timeoutMs()
|
java.lang.String |
toString()
|
(package private) boolean |
wasAttempted(Hash peer)
|
Methods inherited from class net.i2p.router.JobImpl |
---|
dropped, getAddedBy, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected KademliaNetworkDatabaseFacade _facade
static final int MAX_CLOSEST
static final int PER_FLOODFILL_PEER_TIMEOUT
Constructor Detail |
---|
public SearchJob(RouterContext context, KademliaNetworkDatabaseFacade facade, Hash key, Job onSuccess, Job onFailure, long timeoutMs, boolean keepStats, boolean isLease)
Method Detail |
---|
public void runJob()
Job
protected SearchState getState()
protected KademliaNetworkDatabaseFacade getFacade()
public long getExpiration()
public long getTimeoutMs()
static boolean onlyQueryFloodfillPeers(RouterContext ctx)
static boolean isCongested(RouterContext ctx)
protected int getPerPeerTimeoutMs(Hash peer)
protected int getPerPeerTimeoutMs()
protected void searchNext()
protected int getBredth()
protected void continueSearch()
protected void sendSearch(RouterInfo router)
protected void sendLeaseSearch(RouterInfo router)
protected void sendRouterSearch(RouterInfo router)
protected DatabaseLookupMessage buildMessage(TunnelId replyTunnelId, Hash replyGateway, long expiration)
replyTunnelId
- tunnel to receive replies throughreplyGateway
- gateway for the reply tunnelexpiration
- when the search should stopprotected DatabaseLookupMessage buildMessage(long expiration)
void replyFound(DatabaseSearchReplyMessage message, Hash peer)
protected void newPeersFound(int numNewPeers)
protected void fail()
public int addDeferred(Job onFind, Job onFail, long expiration, boolean isLease)
public java.lang.String getName()
Job
public java.lang.String toString()
toString
in class JobImpl
boolean wasAttempted(Hash peer)
long timeoutMs()
boolean add(Hash peer)
void decrementOutstandingFloodfillSearches()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |