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 KeyListener
public short definitelyWantKey(Key key, byte[] saltedKey, ClientContext context)
KeyListener
definitelyWantKey
in interface KeyListener
public HasKeyListener getHasKeyListener()
getHasKeyListener
in interface KeyListener
public short getPriorityClass()
KeyListener
getPriorityClass
in interface KeyListener
public SendableGet[] getRequestsForKey(Key key, byte[] saltedKey, ClientContext context)
KeyListener
getRequestsForKey
in interface KeyListener
public boolean handleBlock(Key key, byte[] saltedKey, KeyBlock found, ClientContext context)
KeyListener
handleBlock
in interface KeyListener
public boolean persistent()
KeyListener
persistent
in interface KeyListener
public boolean probablyWantKey(Key key, byte[] saltedKey)
KeyListener
probablyWantKey
in interface KeyListener
public void onRemove()
KeyListener
onRemove
in interface KeyListener
public boolean isEmpty()
KeyListener
isEmpty
in interface KeyListener
public boolean isSSK()
isSSK
in interface KeyListener