## net.i2p.router.networkdb.kademlia
Class ExploreJob

    java.lang.Object
      net.i2p.router.JobImpl
          net.i2p.router.networkdb.kademlia.SearchJob
              net.i2p.router.networkdb.kademlia.ExploreJob

All Implemented Interfaces:
  Job

class ExploreJob
extends SearchJob

Search for a particular key iteratively until we either find a value, we run out of peers, or the bucket the key belongs in has sufficient values in it. Well, we're skipping the 'bucket gets filled up' test for now, since it'll never get used (at least for a while).

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

Constructor Summary
`ExploreJob(RouterContext context, KademliaNetworkDatabaseFacade facade, Hash key)` 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 DatabaseLookupMessage` `buildMessage(TunnelId replyTunnelId, RouterInfo replyGateway, long expiration)` Build the database search message, but unlike the normal searches, we're more explicit in what we /dont/ want.
`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
`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 SearchState` `getState()`
`long` `getTimeoutMs()`
`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) 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

### _facade

    protected KademliaNetworkDatabaseFacade _facade

### MAX_CLOSEST

    static final int MAX_CLOSEST

  only send the 10 closest "dont tell me about" refs

  See Also:
    Constant Field Values

Constructor Detail

### ExploreJob

    public ExploreJob(RouterContext context,
                      KademliaNetworkDatabaseFacade facade,
                      Hash key)

  Create a new search for the routingKey specified

Method Detail

### buildMessage

    protected DatabaseLookupMessage buildMessage(TunnelId replyTunnelId,
                                                 RouterInfo replyGateway,
                                                 long expiration)

  Build the database search message, but unlike the normal searches, we're more explicit in what we /dont/ want. We don't just ask them to ignore the peers we've already searched on, but to ignore a number of the peers we already know about (in the target key's bucket) as well. Perhaps we may want to ignore other keys too, such as the ones in nearby buckets, but we probably don't want the dontIncludePeers set to get too massive (aka sending the entire routing table as 'dont tell me about these guys'). but maybe we do. dunno. lots of implications.

  Parameters:
    `replyTunnelId` - tunnel to receive replies through
    `replyGateway` - gateway for the reply tunnel
    `expiration` - when the search should stop

### buildMessage

    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). This uses the similar overrides as the other buildMessage above.

  Overrides:
    `buildMessage` in class `SearchJob`

### getBredth

    protected int getBredth()

  max # of concurrent searches

  Overrides:
    `getBredth` in class `SearchJob`

### newPeersFound

    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.

  Overrides:
    `newPeersFound` in class `SearchJob`

### getName

    public java.lang.String getName()

  Description copied from interface: `Job`
  Descriptive name of the task

  Specified by:
    `getName` in interface `Job`
  Overrides:
    `getName` in class `SearchJob`

### runJob

    public void runJob()

  Description copied from interface: `Job`
  Actually perform the task. This call blocks until the Job is complete.

### getState

    protected SearchState getState()

### getFacade

    protected KademliaNetworkDatabaseFacade getFacade()

### getExpiration

    public long getExpiration()

### getTimeoutMs

    public long getTimeoutMs()

### getPerPeerTimeoutMs

    protected int getPerPeerTimeoutMs()

  Let each peer take up to the average successful search RTT

### searchNext

    protected void searchNext()

  Send the next search, or stop if its completed

### continueSearch

    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

### sendSearch

    protected void sendSearch(RouterInfo router)

  Send a search to the given peer

### sendLeaseSearch

    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.

### sendRouterSearch

    protected void sendRouterSearch(RouterInfo router)

  we're searching for a router, so we can just send direct

### buildMessage

    protected DatabaseLookupMessage buildMessage(TunnelId replyTunnelId,
                                                 Hash replyGateway,
                                                 long expiration)

  Build the database search message

  Parameters:
    `replyTunnelId` - tunnel to receive replies through
    `replyGateway` - gateway for the reply tunnel
    `expiration` - when the search should stop

### replyFound

    void replyFound(DatabaseSearchReplyMessage message,
                    Hash peer)

### fail

    protected void fail()

  Search totally failed

### addDeferred

    public int addDeferred(Job onFind,
                           Job onFail,
                           long expiration,
                           boolean isLease)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `JobImpl`

### wasAttempted

    boolean wasAttempted(Hash peer)

### timeoutMs

    long timeoutMs()

### add

    boolean add(Hash peer)