class StoreState extends Object
Tracks peer interaction status, timing information, and operation progress for store operations. Maintains separate sets for pending, attempted, and successful operations to coordinate concurrent store operations and prevent duplicate queries.
Thread-safe implementation using synchronized collections and atomic counters for safe concurrent access from multiple store jobs.
Provides comprehensive state management for reliable data persistence with validation, timeout handling, and operation completion tracking.
| Constructor and Description |
|---|
StoreState(RouterContext ctx,
Hash key,
DatabaseEntry data) |
StoreState(RouterContext ctx,
Hash key,
DatabaseEntry data,
Set<Hash> toSkip) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPending(Hash peer)
Increments attempted count
|
void |
addPending(Hash peer,
MessageWrapper.WrappedMessage msg) |
void |
addSkipped(Hash peer)
we aren't even going to try to contact this peer
|
void |
complete(boolean completed) |
boolean |
completed() |
long |
confirmed(Hash peer) |
Set<Hash> |
getAttempted()
The peers attempted OR skipped.
|
int |
getAttemptedCount()
The number of peers attempted.
|
int |
getCompleteCount() |
DatabaseEntry |
getData() |
int |
getPendingCount() |
MessageWrapper.WrappedMessage |
getPendingMessage(Hash peer) |
Hash |
getSuccessful()
Return a successful peer (a random one if more than one was successful)
or null.
|
Hash |
getTarget() |
long |
getWhenCompleted() |
long |
getWhenStarted() |
void |
replyTimeout(Hash peer) |
String |
toString() |
public StoreState(RouterContext ctx, Hash key, DatabaseEntry data)
public StoreState(RouterContext ctx, Hash key, DatabaseEntry data, Set<Hash> toSkip)
key - the DatabaseEntry hashtoSkip - may be null, if non-null, all attempted and skipped targets will be added as of 0.9.53public void addPending(Hash peer)
public void addPending(Hash peer, MessageWrapper.WrappedMessage msg)
public void addSkipped(Hash peer)
public void complete(boolean completed)
public boolean completed()
public long confirmed(Hash peer)
public Set<Hash> getAttempted()
public int getAttemptedCount()
public int getCompleteCount()
public DatabaseEntry getData()
public int getPendingCount()
public MessageWrapper.WrappedMessage getPendingMessage(Hash peer)
public Hash getSuccessful()
public Hash getTarget()
public long getWhenCompleted()
public long getWhenStarted()
public void replyTimeout(Hash peer)