public abstract class UIDTag
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
accepted |
protected boolean |
noRecordUnlock |
protected boolean |
notRoutedOnwards |
protected boolean |
sourceRestarted |
protected RequestTracker |
tracker |
protected boolean |
unlockedHandler |
Modifier and Type | Method and Description |
---|---|
boolean |
addRoutedTo(PeerNode peer,
boolean offeredKey)
Notify that we are routing to, or fetching an offered key from, a
specific node.
|
void |
clearWaitingForSlot() |
boolean |
countAsSourceRestarted()
Should we deduct this request from the source's limit, instead of
counting it towards it? A normal request is counted towards it.
|
boolean |
currentlyFetchingOfferedKeyFrom(PeerNode peer) |
boolean |
currentlyRoutingTo(PeerNode peer) |
abstract int |
expectedTransfersIn(boolean ignoreLocalVsRemote,
int outwardTransfersPerInsert,
boolean forAccept)
Add up the expected transfers in.
|
abstract int |
expectedTransfersOut(boolean ignoreLocalVsRemote,
int outwardTransfersPerInsert,
boolean forAccept)
Add up the expected transfers out.
|
PeerNode |
getSource()
Get the effective source node (e.g.
|
void |
handlingTimeout(PeerNode next)
Mark a peer as handling a timeout.
|
boolean |
hasRoutedTo(PeerNode peer) |
boolean |
hasSourceReallyRestarted()
Should we send messages to the source?
|
protected void |
innerUnlock(boolean noRecordUnlock) |
abstract boolean |
isInsert() |
boolean |
isLocal()
Is the request local now? I.e.
|
abstract boolean |
isOfferReply() |
boolean |
isSource(PeerNode pn) |
abstract boolean |
isSSK() |
boolean |
isWaitingForSlot() |
abstract void |
logStillPresent(java.lang.Long uid) |
void |
maybeLogStillPresent(long now,
java.lang.Long uid) |
protected boolean |
mustUnlock()
Caller must call innerUnlock(noRecordUnlock) immediately if this returns true.
|
void |
onRestartOrDisconnectSource()
The handler disconnected or restarted.
|
void |
postUnlock() |
void |
reassignToSelf()
Reassign the tag to us rather than its original sender.
|
void |
removeFetchingOfferedKeyFrom(PeerNode next)
Notify that we are no longer fetching an offered key from a specific
node.
|
void |
removeRoutingTo(PeerNode next)
Notify that we are no longer routing to a specific node.
|
void |
setAccepted() |
void |
setNotRoutedOnwards() |
void |
setWaitingForSlot() |
boolean |
shouldStop()
Should we stop the request as soon as is convenient? Normally this
happens when the source is restarted or disconnected.
|
void |
timedOutToHandlerButContinued()
Set when we are going to tell downstream that the request has timed out,
but can't terminate it yet.
|
java.lang.String |
toString() |
void |
unlockHandler() |
void |
unlockHandler(boolean noRecord)
Unlock the handler.
|
boolean |
wasLocal()
Was the request originated locally? This returns the original answer: It is not
affected by reassigning to self.
|
protected final RequestTracker tracker
protected boolean accepted
protected boolean sourceRestarted
protected boolean notRoutedOnwards
protected boolean unlockedHandler
protected boolean noRecordUnlock
public abstract void logStillPresent(java.lang.Long uid)
public boolean addRoutedTo(PeerNode peer, boolean offeredKey)
peer
- The peer we are routing to.offeredKey
- If true, we are fetching an offered key, if false we
are routing a normal request. Fetching an offered key is quite distinct,
notably it has much shorter timeouts.public boolean hasRoutedTo(PeerNode peer)
public boolean currentlyRoutingTo(PeerNode peer)
public boolean currentlyFetchingOfferedKeyFrom(PeerNode peer)
public void removeFetchingOfferedKeyFrom(PeerNode next)
next
- The node we are no longer fetching an offered key from.public void removeRoutingTo(PeerNode next)
next
- The node we are no longer routing to.protected void innerUnlock(boolean noRecordUnlock)
public void postUnlock()
public abstract int expectedTransfersIn(boolean ignoreLocalVsRemote, int outwardTransfersPerInsert, boolean forAccept)
ignoreLocalVsRemote
- If true, pretend that the request is remote even if it's local.outwardTransfersPerInsert
- Expected number of outward transfers for an insert.forAccept
- If true, we are deciding whether to accept a request.
If false, we are deciding whether to SEND a request. We need to be more
careful for the latter than the former, to avoid unnecessary rejections
and mandatory backoffs.public abstract int expectedTransfersOut(boolean ignoreLocalVsRemote, int outwardTransfersPerInsert, boolean forAccept)
ignoreLocalVsRemote
- If true, pretend that the request is remote even if it's local.outwardTransfersPerInsert
- Expected number of outward transfers for an insert.forAccept
- If true, we are deciding whether to accept a request.
If false, we are deciding whether to SEND a request. We need to be more
careful for the latter than the former, to avoid unnecessary rejections
and mandatory backoffs.public void setNotRoutedOnwards()
public PeerNode getSource()
public void reassignToSelf()
public boolean wasLocal()
public boolean isLocal()
public abstract boolean isSSK()
public abstract boolean isInsert()
public abstract boolean isOfferReply()
protected boolean mustUnlock()
public void unlockHandler(boolean noRecord)
public void unlockHandler()
public java.lang.String toString()
toString
in class java.lang.Object
public void handlingTimeout(PeerNode next)
next
- public void maybeLogStillPresent(long now, java.lang.Long uid)
public void setAccepted()
public void timedOutToHandlerButContinued()
public void onRestartOrDisconnectSource()
public boolean countAsSourceRestarted()
public boolean hasSourceReallyRestarted()
public boolean shouldStop()
public boolean isSource(PeerNode pn)
public void setWaitingForSlot()
public void clearWaitingForSlot()
public boolean isWaitingForSlot()