class SearchState extends Object
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 and Description |
|---|
SearchState(RouterContext context,
Hash key)SearchState. |
| Modifier and Type | Method and Description |
|---|---|
void | abort()Aborts this search state. |
void | addInitialLeaseSetResponse(Hash peer,
LeaseSet ls)addInitialLeaseSetResponse. |
void | addLeaseSetResponse(Hash peer,
LeaseSet ls)addLeaseSetResponse. |
void | addPending(Collection<Hash> pending)addPending. |
void | addPending(Hash peer)addPending. |
void | clearInitialTracking()clearInitialTracking. |
void | complete()complete. |
boolean | completed()completed. |
long | dataFound(Hash peer)how long did it take to get the reply, or -1 if we don't know |
Set<Hash> | getAttempted() |
int | getAttemptedSize() |
LeaseSet | getBestInitialLeaseSet() |
Set<Hash> | getClosestAttempted(int max) |
Set<Hash> | getFailed() |
int | getFailedSize() |
LeaseSet | getNewestLeaseSet() |
Set<Hash> | getPending() |
int | getPendingSize() |
Set<Hash> | getRepliedPeers() |
long | getStoredLeaseDate() |
Set<Hash> | getSuccessful() |
int | getSuccessfulSize() |
Hash | getTarget() |
long | getWhenCompleted() |
long | getWhenStarted() |
boolean | isAborted()Checks if this search state has been aborted. |
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)replyTimeout. |
void | setStoredLeaseDate(long date)setStoredLeaseDate. |
boolean | shouldStoreInitial() |
boolean | shouldUpdateStored(LeaseSet ls) |
String | toString()toString. |
boolean | wasAttempted(Hash peer)wasAttempted. |
public SearchState(RouterContext context, Hash key)
public void abort()
public void addInitialLeaseSetResponse(Hash peer, LeaseSet ls)
public void addPending(Collection<Hash> pending)
public void addPending(Hash peer)
public void clearInitialTracking()
public void complete()
public boolean completed()
public long dataFound(Hash peer)
public int getAttemptedSize()
public LeaseSet getBestInitialLeaseSet()
public int getFailedSize()
public LeaseSet getNewestLeaseSet()
public int getPendingSize()
public long getStoredLeaseDate()
public int getSuccessfulSize()
public Hash getTarget()
public long getWhenCompleted()
public long getWhenStarted()
public boolean isAborted()
public void removePending(Hash peer)
public long replyFound(Hash peer)
public void replyTimeout(Hash peer)
public void setStoredLeaseDate(long date)
public boolean shouldStoreInitial()
public boolean shouldUpdateStored(LeaseSet ls)
public boolean wasAttempted(Hash peer)