public class USKProxyCompletionCallback extends java.lang.Object implements GetCompletionCallback, java.io.Serializable
Constructor and Description |
---|
USKProxyCompletionCallback(USK usk,
GetCompletionCallback cb,
boolean persistent) |
Modifier and Type | Method and Description |
---|---|
void |
onBlockSetFinished(ClientGetState state,
ClientContext context)
Called when the ClientGetState knows that it knows about
all the blocks it will need to fetch.
|
void |
onExpectedMIME(ClientMetadata metadata,
ClientContext context)
Called when we know the MIME type of the final data.
|
void |
onExpectedSize(long size,
ClientContext context)
Called when we know the size of the final data.
|
void |
onExpectedTopSize(long size,
long compressed,
int blocksReq,
int blocksTotal,
ClientContext context)
Called when we know the size of the final file, and the number of blocks needed etc.
|
void |
onFailure(FetchException e,
ClientGetState state,
ClientContext context) |
void |
onFinalizedMetadata() |
void |
onHashes(HashResult[] hashes,
ClientContext context)
Called when we know the HashResult of the final file.
|
void |
onSplitfileCompatibilityMode(InsertContext.CompatibilityMode min,
InsertContext.CompatibilityMode max,
byte[] splitfileKey,
boolean dontCompress,
boolean bottomLayer,
boolean definitiveAnyway,
ClientContext context)
Called when we know the settings for the splitfile.
|
void |
onSuccess(StreamGenerator streamGenerator,
ClientMetadata clientMetadata,
java.util.List<? extends Compressor> decompressors,
ClientGetState state,
ClientContext context) |
void |
onTransition(ClientGetState oldState,
ClientGetState newState,
ClientContext context)
Called when the ClientGetState handling the request yields control to another
ClientGetState.
|
public USKProxyCompletionCallback(USK usk, GetCompletionCallback cb, boolean persistent)
public void onSuccess(StreamGenerator streamGenerator, ClientMetadata clientMetadata, java.util.List<? extends Compressor> decompressors, ClientGetState state, ClientContext context)
onSuccess
in interface GetCompletionCallback
public void onFailure(FetchException e, ClientGetState state, ClientContext context)
onFailure
in interface GetCompletionCallback
public void onBlockSetFinished(ClientGetState state, ClientContext context)
GetCompletionCallback
onBlockSetFinished
in interface GetCompletionCallback
public void onTransition(ClientGetState oldState, ClientGetState newState, ClientContext context)
GetCompletionCallback
onTransition
in interface GetCompletionCallback
oldState
- The old ClientGetState.newState
- The new ClientGetState.context
- The database handle. Must not be used by other threads.public void onExpectedMIME(ClientMetadata metadata, ClientContext context) throws FetchException
GetCompletionCallback
onExpectedMIME
in interface GetCompletionCallback
metadata
- The MIME type, possibly including parameters, as a String.
E.g. "text/html; charset=ISO-8859-1".context
- Utility object containing helpers, mostly not persistent, such as the Ticker, temporary storage factories etc.FetchException
- The callee can throw a FetchException to terminate the download e.g.
if they can't handle the MIME type.public void onExpectedSize(long size, ClientContext context)
GetCompletionCallback
onExpectedSize
in interface GetCompletionCallback
size
- The expected size of the final data.context
- Utility object containing helpers, mostly not persistent, such as the Ticker, temporary storage factories etc.public void onFinalizedMetadata()
onFinalizedMetadata
in interface GetCompletionCallback
public void onExpectedTopSize(long size, long compressed, int blocksReq, int blocksTotal, ClientContext context)
GetCompletionCallback
onExpectedTopSize
in interface GetCompletionCallback
size
- The final size of the data.compressed
- The size of the data after compression / before decompression.blocksReq
- The number of blocks needed to decode the file.blocksTotal
- The total number of blocks available.context
- Utility object containing helpers, mostly not persistent, such as the Ticker, temporary storage factories etc.public void onSplitfileCompatibilityMode(InsertContext.CompatibilityMode min, InsertContext.CompatibilityMode max, byte[] splitfileKey, boolean dontCompress, boolean bottomLayer, boolean definitiveAnyway, ClientContext context)
GetCompletionCallback
onSplitfileCompatibilityMode
in interface GetCompletionCallback
min
- The lowest CompatibilityMode that appears to be valid based on what we've fetched so far.max
- The highest CompatibilityMode that appears to be valid based on what we've fetched so far.splitfileKey
- The fixed byte[] encryption key used on insert. On anything recent, we generate a single key, randomly for an SSK,
or based on the content for a CHK, and use it for everything. This saves metadata space and improves security for SSKs.dontCompress
- Whether the content is compressed. If false, the dontCompress option was used.bottomLayer
- Whether this report originates at the bottom layer of the splitfile pyramid. I.e. the actual file, not the file containing
the metadata to fetch the file (this can recurse for several levels!)definitiveAnyway
- Whether this report is definitive even though it's not from the bottom layer. This is true of recent splitfiles,
where we store all the data in the top key.context
- Utility object containing helpers, mostly not persistent, such as the Ticker, temporary storage factories etc.public void onHashes(HashResult[] hashes, ClientContext context)
GetCompletionCallback
onHashes
in interface GetCompletionCallback
hashes
- A set of hashes for the final file content.context
- Utility object containing helpers, mostly not persistent, such as the Ticker, temporary storage factories etc.