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
FetchException
public SplitFileFetcherKeyListener(SplitFileFetcherStorage storage, SplitFileFetcherStorageCallback callback, java.io.DataInputStream dis, boolean persistent, boolean newSalt) throws java.io.IOException, StorageFormatException
java.io.IOException
StorageFormatException
public int paddedMainBloomFilterSize()
public boolean probablyWantKey(Key key, byte[] saltedKey)
KeyListener
probablyWantKey
in interface KeyListener
public short definitelyWantKey(Key key, byte[] saltedKey, ClientContext context)
KeyListener
definitelyWantKey
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 block, ClientContext context)
KeyListener
handleBlock
in interface KeyListener
public boolean persistent()
KeyListener
persistent
in interface KeyListener
public short getPriorityClass()
KeyListener
getPriorityClass
in interface KeyListener
public long countKeys()
countKeys
in interface KeyListener
public HasKeyListener getHasKeyListener()
getHasKeyListener
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
public void writeStaticSettings(java.io.DataOutputStream dos) throws java.io.IOException
java.io.IOException
public boolean needsKeys()
public void addedAllKeys()