public class USKFetcher extends java.lang.Object implements ClientGetState, USKCallback, HasKeyListener, KeyListener
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCallback(USKFetcherCallback cb)
Callbacks are told when the USKFetcher finishes, and unless background poll is
enabled, they are only sent onFoundEdition *once*, on completion.
|
void |
addHintEdition(long suggestedEdition) |
void |
addSubscriber(USKCallback cb,
long hint)
Add a subscriber.
|
void |
cancel(ClientContext context)
Cancel the request, and call onFailure() on the callback in order to tell
downstream (ultimately the client) that cancel has succeeded, and to allow
it to call removeFrom() to avoid a database leak.
|
void |
changeUSKPollParameters(long time,
int tries,
ClientContext context)
FIXME this is a special case hack
For a generic solution see https://bugs.freenetproject.org/view.php?id=4984
|
long |
countKeys() |
short |
definitelyWantKey(Key key,
byte[] saltedKey,
ClientContext context)
Do we want the key? This is called by the ULPR code, because fetching the
key will involve significant work.
|
HasKeyListener |
getHasKeyListener() |
USK |
getOriginalUSK() |
short |
getPollingPriorityNormal()
Priority at which the polling should run normally.
|
short |
getPollingPriorityProgress()
Priority at which the polling should run when starting, or immediately after making some progress.
|
short |
getPriorityClass()
Priority of the associated request.
|
SendableGet[] |
getRequestsForKey(Key key,
byte[] saltedKey,
ClientContext context)
Find the requests related to a specific key, used in retrying after cooldown.
|
long |
getToken()
Get a long value which may be passed around to identify this request (e.g.
|
FreenetURI |
getURI() |
boolean |
handleBlock(Key key,
byte[] saltedKey,
KeyBlock found,
ClientContext context)
Handle the found data, if we really want it.
|
boolean |
hasCallbacks() |
boolean |
hasSubscribers() |
boolean |
isCancelled()
Is it cancelled?
|
boolean |
isEmpty()
Has the request finished? If every key has been found, or enough keys have
been found, return true so that the caller can remove it from the list.
|
boolean |
isFinished() |
boolean |
isSSK() |
KeyListener |
makeKeyListener(ClientContext context,
boolean onStartup)
Create a KeyListener, a transient object used to determine which keys we
want, and to handle any blocks found.
|
void |
onCheckEnteredFiniteCooldown(ClientContext context) |
void |
onDBRsFinished(ClientContext context) |
void |
onFail(freenet.client.async.USKFetcher.USKAttempt attempt,
ClientContext context) |
void |
onFoundEdition(long ed,
USK key,
ClientContext context,
boolean metadata,
short codec,
byte[] data,
boolean newKnownGood,
boolean newSlotToo)
Found the latest edition.
|
void |
onRemove()
Deactivate the request once it has been removed.
|
void |
onResume(ClientContext context)
Called on restarting the node for a persistent request.
|
void |
onShutdown(ClientContext context)
Called just before the final write of client.dat before the node shuts down.
|
boolean |
persistent()
Is this related to a persistent request?
|
boolean |
probablyWantKey(Key key,
byte[] saltedKey)
Fast guess at whether we want a key or not.
|
void |
processDBRHint(long hint,
ClientContext context,
freenet.client.async.USKFetcher.DBRAttempt dbrAttempt) |
void |
removeCallback(USKCallback cb) |
void |
removeSubscriber(USKCallback cb,
ClientContext context) |
void |
schedule(ClientContext context)
Schedule the request on the ClientRequestScheduler.
|
void |
schedule(long delay,
ClientContext context) |
public boolean addCallback(USKFetcherCallback cb)
cb - public void onDBRsFinished(ClientContext context)
public void processDBRHint(long hint,
ClientContext context,
freenet.client.async.USKFetcher.DBRAttempt dbrAttempt)
public void onCheckEnteredFiniteCooldown(ClientContext context)
public void onFail(freenet.client.async.USKFetcher.USKAttempt attempt,
ClientContext context)
public FreenetURI getURI()
public boolean isFinished()
public USK getOriginalUSK()
public void schedule(long delay,
ClientContext context)
public void schedule(ClientContext context)
ClientGetStateschedule in interface ClientGetStatepublic void cancel(ClientContext context)
ClientGetStatecancel in interface ClientGetStatepublic void addSubscriber(USKCallback cb, long hint)
cb - public boolean hasSubscribers()
public boolean hasCallbacks()
public void removeSubscriber(USKCallback cb, ClientContext context)
public void removeCallback(USKCallback cb)
public long getToken()
ClientGetStategetToken in interface ClientGetStatepublic short getPollingPriorityNormal()
USKCallbackgetPollingPriorityNormal in interface USKCallbackpublic short getPollingPriorityProgress()
USKCallbackgetPollingPriorityProgress in interface USKCallbackpublic void onFoundEdition(long ed,
USK key,
ClientContext context,
boolean metadata,
short codec,
byte[] data,
boolean newKnownGood,
boolean newSlotToo)
USKCallbackonFoundEdition in interface USKCallbacked - The edition number.key - A copy of the key with new edition setnewKnownGood - If the highest known good edition (which has actually been
fetched with what it pointed to) has increased. Otherwise, the highest known
SSK slot has been increased, from which searches will start, but we do not
know whether it can actually be fetched successfully.newSlotToo - If newKnownGood is set, this indicates whether it is also a
new highest known SSK slot. If newKnownGood is not set, there is always a new
highest known SSK slot.public boolean isCancelled()
HasKeyListenerisCancelled in interface HasKeyListenerpublic KeyListener makeKeyListener(ClientContext context, boolean onStartup)
HasKeyListenermakeKeyListener in interface HasKeyListenerpublic long countKeys()
countKeys in interface KeyListenerpublic short definitelyWantKey(Key key, byte[] saltedKey, ClientContext context)
KeyListenerdefinitelyWantKey in interface KeyListenerpublic HasKeyListener getHasKeyListener()
getHasKeyListener in interface KeyListenerpublic short getPriorityClass()
KeyListenergetPriorityClass in interface KeyListenerpublic SendableGet[] getRequestsForKey(Key key, byte[] saltedKey, ClientContext context)
KeyListenergetRequestsForKey in interface KeyListenerpublic boolean handleBlock(Key key, byte[] saltedKey, KeyBlock found, ClientContext context)
KeyListenerhandleBlock in interface KeyListenerpublic boolean isEmpty()
KeyListenerisEmpty in interface KeyListenerpublic boolean isSSK()
isSSK in interface KeyListenerpublic void onRemove()
KeyListeneronRemove in interface KeyListenerpublic boolean persistent()
KeyListenerpersistent in interface KeyListenerpublic boolean probablyWantKey(Key key, byte[] saltedKey)
KeyListenerprobablyWantKey in interface KeyListenerpublic void changeUSKPollParameters(long time,
int tries,
ClientContext context)
public void addHintEdition(long suggestedEdition)
public void onResume(ClientContext context)
ClientGetStateonResume in interface ClientGetStatepublic void onShutdown(ClientContext context)
ClientGetStateonShutdown in interface ClientGetState