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.MalformedURLException
protected USKInserter()
public void schedule(ClientContext context) throws InsertException
ClientPutState
schedule
in interface ClientPutState
InsertException
public void onFoundEdition(long l, USK key, ClientContext context, boolean lastContentWasMetadata, short codec, byte[] hisData, boolean newKnownGood, boolean newSlotToo)
USKFetcherCallback
onFoundEdition
in interface USKCallback
onFoundEdition
in interface USKFetcherCallback
l
- 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 PutCompletionCallback
public void onFailure(InsertException e, ClientPutState state, ClientContext context)
onFailure
in interface PutCompletionCallback
public int hashCode()
hashCode
in class java.lang.Object
public BaseClientPutter getParent()
ClientPutState
getParent
in interface ClientPutState
public void cancel(ClientContext context)
ClientPutState
cancel
in interface ClientPutState
public void onFailure(ClientContext context)
USKFetcherCallback
onFailure
in interface USKFetcherCallback
public void onCancelled(ClientContext context)
onCancelled
in interface USKFetcherCallback
public void onEncode(BaseClientKey key, ClientPutState state, ClientContext context)
PutCompletionCallback
onEncode
in interface PutCompletionCallback
public void onTransition(ClientPutState oldState, ClientPutState newState, ClientContext context)
onTransition
in interface PutCompletionCallback
public void onMetadata(Metadata m, ClientPutState state, ClientContext context)
PutCompletionCallback
onMetadata
in interface PutCompletionCallback
public void onBlockSetFinished(ClientPutState state, ClientContext context)
PutCompletionCallback
onBlockSetFinished
in interface PutCompletionCallback
public java.lang.Object getToken()
ClientPutState
getToken
in interface ClientPutState
public void onFetchable(ClientPutState state)
PutCompletionCallback
onFetchable
in interface PutCompletionCallback
public short getPollingPriorityNormal()
USKCallback
getPollingPriorityNormal
in interface USKCallback
public short getPollingPriorityProgress()
USKCallback
getPollingPriorityProgress
in interface USKCallback
public void onMetadata(Bucket meta, ClientPutState state, ClientContext context)
PutCompletionCallback
onMetadata
in interface PutCompletionCallback
public void onResume(ClientContext context) throws InsertException, ResumeFailedException
ClientPutState
onResume
in interface ClientPutState
onResume
in interface PutCompletionCallback
InsertException
ResumeFailedException
public void onShutdown(ClientContext context)
ClientPutState
onShutdown
in interface ClientPutState