Class StoreState
- java.lang.Object
-
- net.i2p.router.networkdb.kademlia.StoreState
-
class StoreState extends Object
Tracks the state of a StoreJob
-
-
Constructor Summary
Constructors Constructor Description StoreState(RouterContext ctx, Hash key, DatabaseEntry data)StoreState(RouterContext ctx, Hash key, DatabaseEntry data, Set<Hash> toSkip)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPending(Hash peer)Increments attempted countvoidaddPending(Hash peer, MessageWrapper.WrappedMessage msg)voidaddSkipped(Hash peer)we aren't even going to try to contact this peervoidcomplete(boolean completed)booleancompleted()longconfirmed(Hash peer)Set<Hash>getAttempted()The peers attempted OR skipped.intgetAttemptedCount()The number of peers attempted.intgetCompleteCount()DatabaseEntrygetData()intgetPendingCount()The number of peers pending.MessageWrapper.WrappedMessagegetPendingMessage(Hash peer)HashgetSuccessful()Return a successful peer (a random one if more than one was successful) or null.HashgetTarget()longgetWhenCompleted()longgetWhenStarted()voidreplyTimeout(Hash peer)StringtoString()
-
-
-
Constructor Detail
-
StoreState
public StoreState(RouterContext ctx, Hash key, DatabaseEntry data)
-
StoreState
public StoreState(RouterContext ctx, Hash key, DatabaseEntry data, Set<Hash> toSkip)
- Parameters:
key- the DatabaseEntry hashtoSkip- may be null, if non-null, all attempted and skipped targets will be added as of 0.9.53
-
-
Method Detail
-
getTarget
public Hash getTarget()
-
getData
public DatabaseEntry getData()
-
getPendingCount
public int getPendingCount()
The number of peers pending.- Since:
- 0.9.53 replaces getPending()
-
getAttempted
public Set<Hash> getAttempted()
The peers attempted OR skipped. DOES include skipped peers. Use getAttemptedCount for the number of attempts.
-
getAttemptedCount
public int getAttemptedCount()
The number of peers attempted. Does not include skipped peers. Do not use getAttempted().size() as that does include skipped peers.- Since:
- 0.9.53
-
getSuccessful
public Hash getSuccessful()
Return a successful peer (a random one if more than one was successful) or null.- Since:
- 0.9.53 formerly returned a copy of the Set
-
completed
public boolean completed()
-
complete
public void complete(boolean completed)
-
getCompleteCount
public int getCompleteCount()
-
getWhenStarted
public long getWhenStarted()
-
getWhenCompleted
public long getWhenCompleted()
-
addPending
public void addPending(Hash peer, MessageWrapper.WrappedMessage msg)
-
getPendingMessage
public MessageWrapper.WrappedMessage getPendingMessage(Hash peer)
-
addPending
public void addPending(Hash peer)
Increments attempted count
-
addSkipped
public void addSkipped(Hash peer)
we aren't even going to try to contact this peer
-
confirmed
public long confirmed(Hash peer)
-
replyTimeout
public void replyTimeout(Hash peer)
-
-