public class USKInserter extends java.lang.Object implements ClientPutState, USKFetcherCallback, PutCompletionCallback, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
java.lang.Object |
tokenObject |
| Modifier | Constructor and Description |
|---|---|
protected |
USKInserter() |
|
USKInserter(BaseClientPutter parent,
Bucket data,
short compressionCodec,
FreenetURI uri,
InsertContext ctx,
PutCompletionCallback cb,
boolean isMetadata,
int sourceLength,
int token,
boolean addToParent,
java.lang.Object tokenObject,
ClientContext context,
boolean freeData,
boolean persistent,
boolean realTimeFlag,
int extraInserts,
byte cryptoAlgorithm,
byte[] forceCryptoKey) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(ClientContext context)
Cancel the request.
|
BaseClientPutter |
getParent()
Get the BaseClientPutter responsible for this request state.
|
short |
getPollingPriorityNormal()
Priority at which the polling should run normally.
|
short |
getPollingPriorityProgress()
Priority at which the polling should run when starting, or immediately after making some progress.
|
java.lang.Object |
getToken()
Get the token, an object which is passed around with the insert and may be
used by callers.
|
int |
hashCode() |
void |
onBlockSetFinished(ClientPutState state,
ClientContext context)
Called when the ClientPutState knows that it knows about
all the blocks it will need to put.
|
void |
onCancelled(ClientContext context) |
void |
onEncode(BaseClientKey key,
ClientPutState state,
ClientContext context)
Called when we know the final URI of the state in question.
|
void |
onFailure(ClientContext context)
Failed to find any edition at all (later than or equal to the specified hint)
|
void |
onFailure(InsertException e,
ClientPutState state,
ClientContext context) |
void |
onFetchable(ClientPutState state)
Called when enough data has been inserted that the file can be
retrieved, even if not all data has been inserted yet.
|
void |
onFoundEdition(long l,
USK key,
ClientContext context,
boolean lastContentWasMetadata,
short codec,
byte[] hisData,
boolean newKnownGood,
boolean newSlotToo)
Found the latest edition.
|
void |
onMetadata(Bucket meta,
ClientPutState state,
ClientContext context)
Called as an alternative to onEncode, if a metadata length threshold
was specified.
|
void |
onMetadata(Metadata m,
ClientPutState state,
ClientContext context)
Only called if explicitly asked for, in which case, generally
the metadata won't be inserted.
|
void |
onResume(ClientContext context)
Called on restarting the node for a persistent request.
|
void |
onShutdown(ClientContext context)
Called just before the final write of client.dat before the node shuts down.
|
void |
onSuccess(ClientPutState state,
ClientContext context) |
void |
onTransition(ClientPutState oldState,
ClientPutState newState,
ClientContext context) |
void |
schedule(ClientContext context)
Schedule the request.
|
public USKInserter(BaseClientPutter parent, Bucket data, short compressionCodec, FreenetURI uri, InsertContext ctx, PutCompletionCallback cb, boolean isMetadata, int sourceLength, int token, boolean addToParent, java.lang.Object tokenObject, ClientContext context, boolean freeData, boolean persistent, boolean realTimeFlag, int extraInserts, byte cryptoAlgorithm, byte[] forceCryptoKey) throws java.net.MalformedURLException
java.net.MalformedURLExceptionprotected USKInserter()
public void schedule(ClientContext context) throws InsertException
ClientPutStateschedule in interface ClientPutStateInsertExceptionpublic void onFoundEdition(long l,
USK key,
ClientContext context,
boolean lastContentWasMetadata,
short codec,
byte[] hisData,
boolean newKnownGood,
boolean newSlotToo)
USKFetcherCallbackonFoundEdition in interface USKCallbackonFoundEdition in interface USKFetcherCallbackl - The edition number.key - The key.newKnownGood - If the highest known good edition (which has actually been
fetched with what it pointed to) has increased. Otherwise, the highest known
SSK slot has been increased, from which searches will start, but we do not
know whether it can actually be fetched successfully.newSlotToo - If newKnownGood is set, this indicates whether it is also a
new highest known SSK slot. If newKnownGood is not set, there is always a new
highest known SSK slot.public void onSuccess(ClientPutState state, ClientContext context)
onSuccess in interface PutCompletionCallbackpublic void onFailure(InsertException e, ClientPutState state, ClientContext context)
onFailure in interface PutCompletionCallbackpublic int hashCode()
hashCode in class java.lang.Objectpublic BaseClientPutter getParent()
ClientPutStategetParent in interface ClientPutStatepublic void cancel(ClientContext context)
ClientPutStatecancel in interface ClientPutStatepublic void onFailure(ClientContext context)
USKFetcherCallbackonFailure in interface USKFetcherCallbackpublic void onCancelled(ClientContext context)
onCancelled in interface USKFetcherCallbackpublic void onEncode(BaseClientKey key, ClientPutState state, ClientContext context)
PutCompletionCallbackonEncode in interface PutCompletionCallbackpublic void onTransition(ClientPutState oldState, ClientPutState newState, ClientContext context)
onTransition in interface PutCompletionCallbackpublic void onMetadata(Metadata m, ClientPutState state, ClientContext context)
PutCompletionCallbackonMetadata in interface PutCompletionCallbackpublic void onBlockSetFinished(ClientPutState state, ClientContext context)
PutCompletionCallbackonBlockSetFinished in interface PutCompletionCallbackpublic java.lang.Object getToken()
ClientPutStategetToken in interface ClientPutStatepublic void onFetchable(ClientPutState state)
PutCompletionCallbackonFetchable in interface PutCompletionCallbackpublic short getPollingPriorityNormal()
USKCallbackgetPollingPriorityNormal in interface USKCallbackpublic short getPollingPriorityProgress()
USKCallbackgetPollingPriorityProgress in interface USKCallbackpublic void onMetadata(Bucket meta, ClientPutState state, ClientContext context)
PutCompletionCallbackonMetadata in interface PutCompletionCallbackpublic void onResume(ClientContext context) throws InsertException, ResumeFailedException
ClientPutStateonResume in interface ClientPutStateonResume in interface PutCompletionCallbackInsertExceptionResumeFailedExceptionpublic void onShutdown(ClientContext context)
ClientPutStateonShutdown in interface ClientPutState