public class SplitFileFetcherKeyListener extends java.lang.Object implements KeyListener
| Constructor and Description |
|---|
SplitFileFetcherKeyListener(SplitFileFetcherStorageCallback fetcher,
SplitFileFetcherStorage storage,
boolean persistent,
byte[] localSalt,
int origSize,
int segBlocks,
int segments)
Create a set of bloom filters for a new download.
|
SplitFileFetcherKeyListener(SplitFileFetcherStorage storage,
SplitFileFetcherStorageCallback callback,
java.io.DataInputStream dis,
boolean persistent,
boolean newSalt) |
| Modifier and Type | Method and Description |
|---|---|
void |
addedAllKeys() |
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 block,
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() |
boolean |
needsKeys() |
void |
onRemove()
Deactivate the request once it has been removed.
|
int |
paddedMainBloomFilterSize() |
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 |
writeStaticSettings(java.io.DataOutputStream dos) |
public SplitFileFetcherKeyListener(SplitFileFetcherStorageCallback fetcher, SplitFileFetcherStorage storage, boolean persistent, byte[] localSalt, int origSize, int segBlocks, int segments) throws FetchException
FetchExceptionpublic SplitFileFetcherKeyListener(SplitFileFetcherStorage storage, SplitFileFetcherStorageCallback callback, java.io.DataInputStream dis, boolean persistent, boolean newSalt) throws java.io.IOException, StorageFormatException
java.io.IOExceptionStorageFormatExceptionpublic int paddedMainBloomFilterSize()
public boolean probablyWantKey(Key key, byte[] saltedKey)
KeyListenerprobablyWantKey in interface KeyListenerpublic short definitelyWantKey(Key key, byte[] saltedKey, ClientContext context)
KeyListenerdefinitelyWantKey in interface KeyListenerpublic SendableGet[] getRequestsForKey(Key key, byte[] saltedKey, ClientContext context)
KeyListenergetRequestsForKey in interface KeyListenerpublic boolean handleBlock(Key key, byte[] saltedKey, KeyBlock block, ClientContext context)
KeyListenerhandleBlock in interface KeyListenerpublic boolean persistent()
KeyListenerpersistent in interface KeyListenerpublic short getPriorityClass()
KeyListenergetPriorityClass in interface KeyListenerpublic long countKeys()
countKeys in interface KeyListenerpublic HasKeyListener getHasKeyListener()
getHasKeyListener in interface KeyListenerpublic void onRemove()
KeyListeneronRemove in interface KeyListenerpublic boolean isEmpty()
KeyListenerisEmpty in interface KeyListenerpublic boolean isSSK()
isSSK in interface KeyListenerpublic void writeStaticSettings(java.io.DataOutputStream dos)
throws java.io.IOException
java.io.IOExceptionpublic boolean needsKeys()
public void addedAllKeys()