net.i2p.router.networkdb.kademlia

## Class SearchState

- java.lang.Object
- - net.i2p.router.networkdb.kademlia.SearchState

-     class SearchState
      extends Object

  Manages state for network database search operations.

  Tracks peer interaction status, timing information, and search progress for iterative Kademlia searches. Maintains separate sets for pending, attempted, failed, successful, and replied peers to coordinate concurrent search operations and prevent duplicate queries.

  Thread-safe implementation using synchronized collections and atomic counters for safe concurrent access from multiple search jobs.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearchState(RouterContext context, Hash key)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abort()`
    `void` | `addPending(Collection<Hash> pending)`
    `void` | `addPending(Hash peer)`
    `void` | `complete()`
    `boolean` | `completed()`
    `long` | `dataFound(Hash peer)` how long did it take to get the reply, or -1 if we don't know
    `Set<Hash>` | `getAttempted()`
    `Set<Hash>` | `getClosestAttempted(int max)`
    `Set<Hash>` | `getFailed()`
    `Set<Hash>` | `getPending()`
    `Set<Hash>` | `getRepliedPeers()`
    `Set<Hash>` | `getSuccessful()`
    `Hash` | `getTarget()`
    `long` | `getWhenCompleted()`
    `long` | `getWhenStarted()`
    `boolean` | `isAborted()`
    `void` | `removePending(Hash peer)` we didn't actually want to add this peer as part of the pending list...
    `long` | `replyFound(Hash peer)` how long did it take to get the reply, or -1 if we dont know
    `void` | `replyTimeout(Hash peer)`
    `String` | `toString()`
    `boolean` | `wasAttempted(Hash peer)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SearchState

          public SearchState(RouterContext context,
                             Hash key)

  - ### Method Detail

    - #### abort

          public void abort()

    - #### addPending

          public void addPending(Collection<Hash> pending)

    - #### addPending

          public void addPending(Hash peer)

    - #### complete

          public void complete()

    - #### completed

          public boolean completed()

    - #### dataFound

          public long dataFound(Hash peer)

      how long did it take to get the reply, or -1 if we don't know

    - #### getAttempted

          public Set<Hash> getAttempted()

    - #### getClosestAttempted

          public Set<Hash> getClosestAttempted(int max)

    - #### getFailed

          public Set<Hash> getFailed()

    - #### getPending

          public Set<Hash> getPending()

    - #### getRepliedPeers

          public Set<Hash> getRepliedPeers()

    - #### getSuccessful

          public Set<Hash> getSuccessful()

    - #### getTarget

          public Hash getTarget()

    - #### getWhenCompleted

          public long getWhenCompleted()

    - #### getWhenStarted

          public long getWhenStarted()

    - #### isAborted

          public boolean isAborted()

    - #### removePending

          public void removePending(Hash peer)

      we didn't actually want to add this peer as part of the pending list...

    - #### replyFound

          public long replyFound(Hash peer)

      how long did it take to get the reply, or -1 if we dont know

    - #### replyTimeout

          public void replyTimeout(Hash peer)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### wasAttempted

          public boolean wasAttempted(Hash peer)