public class SingleKeyListener extends java.lang.Object implements KeyListener
| Constructor and Description |
|---|
SingleKeyListener(Key key,
BaseSingleFileFetcher fetcher,
short prio,
boolean persistent) |
| Modifier and Type | Method and Description |
|---|---|
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() |
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.
|
boolean |
handleBlock(Key key,
byte[] saltedKey,
KeyBlock found,
ClientContext context)
Handle the found data, if we really want it.
|
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 |
isSSK() |
void |
onRemove()
Deactivate the request once it has been removed.
|
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.
|
public SingleKeyListener(Key key, BaseSingleFileFetcher fetcher, short prio, boolean persistent)
public 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 persistent()
KeyListenerpersistent in interface KeyListenerpublic boolean probablyWantKey(Key key, byte[] saltedKey)
KeyListenerprobablyWantKey in interface KeyListenerpublic void onRemove()
KeyListeneronRemove in interface KeyListenerpublic boolean isEmpty()
KeyListenerisEmpty in interface KeyListenerpublic boolean isSSK()
isSSK in interface KeyListener