public class SingleBlockInserter extends SendableInsert implements ClientPutState, java.io.Serializable
parentGrabArray, persistent, realTimeFlag| Constructor and Description |
|---|
SingleBlockInserter(BaseClientPutter parent,
Bucket data,
short compressionCodec,
FreenetURI uri,
InsertContext ctx,
boolean realTimeFlag,
PutCompletionCallback cb,
boolean isMetadata,
int sourceLength,
int token,
boolean addToParent,
boolean dontSendEncoded,
java.lang.Object tokenObject,
ClientContext context,
boolean persistent,
boolean freeData,
int extraInserts,
byte cryptoAlgorithm,
byte[] cryptoKey)
Create a SingleBlockInserter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(ClientContext context)
Cancel the request.
|
boolean |
canWriteClientCache() |
SendableRequestItem |
chooseKey(KeysFetchingLocally ignored,
ClientContext context)
Choose a key to fetch.
|
long |
countAllKeys(ClientContext context)
All key identifiers.
|
long |
countSendableKeys(ClientContext context)
All key identifiers currently eligible to be sent.
|
protected ClientKeyBlock |
encode(ClientContext context,
boolean calledByCB) |
boolean |
forkOnCacheable() |
ClientKeyBlock |
getBlock(ClientContext context,
boolean calledByCB) |
RequestClient |
getClient()
Get client context object.
|
ClientRequester |
getClientRequest()
Get the ClientRequest.
|
ClientKey |
getKeyNoEncode() |
BaseClientPutter |
getParent()
Get the BaseClientPutter responsible for this request state.
|
short |
getPriorityClass()
Get the priority class of the request.
|
SendableRequestSender |
getSender(ClientContext context)
Get or create a SendableRequestSender for this object.
|
java.lang.Object |
getToken()
Get the token, an object which is passed around with the insert and may be
used by callers.
|
FreenetURI |
getURI(ClientContext context) |
FreenetURI |
getURINoEncode() |
long |
getWakeupTime(ClientContext context,
long now)
Unless this is a RandomGrabArrayItem, this will return the wakeup time for the subtree
rooted at this node.
|
protected ClientKeyBlock |
innerEncode(RandomSource random) |
protected static ClientKeyBlock |
innerEncode(RandomSource random,
FreenetURI uri,
Bucket sourceData,
boolean isMetadata,
short compressionCodec,
int sourceLength,
java.lang.String compressorDescriptor,
byte cryptoAlgorithm,
byte[] cryptoKey) |
void |
innerOnResume(ClientContext context) |
boolean |
isCancelled()
If true, the request has been cancelled, or has completed, either way it need not
be registered any more.
|
boolean |
isEmpty() |
boolean |
isSSK()
Is this an SSK? For purposes of determining which scheduler to use.
|
boolean |
localRequestOnly() |
protected void |
onEncode(ClientKey key,
ClientContext context) |
void |
onEncode(SendableRequestItem token,
ClientKey key,
ClientContext context)
Encoded a key
|
void |
onFailure(LowLevelPutException e,
SendableRequestItem keyNum,
ClientContext context)
Called when we don't!
|
void |
onShutdown(ClientContext context)
Called just before the final write of client.dat before the node shuts down.
|
void |
onSuccess(SendableRequestItem keyNum,
ClientKey key,
ClientContext context)
Called when we successfully insert the data
|
void |
schedule(ClientContext context)
Schedule the request.
|
void |
tryEncode(ClientContext context)
Attempt to encode the block, if necessary
|
getScheduler, internalError, isInsert, onResumeclearWakeupTime, getParentGrabArray, getSchedulerGroup, hashCode, knowsParentGrabArray, objectToString, persistent, realTimeFlag, reduceWakeupTime, setParentGrabArray, unregisterclone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, waitonResumepublic SingleBlockInserter(BaseClientPutter parent, Bucket data, short compressionCodec, FreenetURI uri, InsertContext ctx, boolean realTimeFlag, PutCompletionCallback cb, boolean isMetadata, int sourceLength, int token, boolean addToParent, boolean dontSendEncoded, java.lang.Object tokenObject, ClientContext context, boolean persistent, boolean freeData, int extraInserts, byte cryptoAlgorithm, byte[] cryptoKey)
parent - The parent. Must be activated.data - compressionCodec - The compression codec.uri - ctx - realTimeFlag - cb - isMetadata - sourceLength - The length of the original, uncompressed data.token - addToParent - dontSendEncoded - tokenObject - context - persistent - freeData - extraInserts - cryptoAlgorithm - cryptoKey - protected ClientKeyBlock innerEncode(RandomSource random) throws InsertException
InsertExceptionprotected static ClientKeyBlock innerEncode(RandomSource random, FreenetURI uri, Bucket sourceData, boolean isMetadata, short compressionCodec, int sourceLength, java.lang.String compressorDescriptor, byte cryptoAlgorithm, byte[] cryptoKey) throws InsertException, CHKEncodeException, java.io.IOException, SSKEncodeException, java.net.MalformedURLException, InvalidCompressionCodecException
InsertExceptionCHKEncodeExceptionjava.io.IOExceptionSSKEncodeExceptionjava.net.MalformedURLExceptionInvalidCompressionCodecExceptionprotected void onEncode(ClientKey key, ClientContext context)
protected ClientKeyBlock encode(ClientContext context, boolean calledByCB) throws InsertException
InsertExceptionpublic short getPriorityClass()
SendableRequestgetPriorityClass in class SendableRequestpublic void onFailure(LowLevelPutException e, SendableRequestItem keyNum, ClientContext context)
SendableInsertonFailure in class SendableInsertpublic ClientKeyBlock getBlock(ClientContext context, boolean calledByCB)
public void schedule(ClientContext context) throws InsertException
ClientPutStateschedule in interface ClientPutStateInsertExceptionpublic boolean isSSK()
SendableRequestisSSK in class SendableRequestpublic FreenetURI getURI(ClientContext context)
public FreenetURI getURINoEncode()
public ClientKey getKeyNoEncode()
public void onSuccess(SendableRequestItem keyNum, ClientKey key, ClientContext context)
SendableInsertonSuccess in class SendableInsertpublic BaseClientPutter getParent()
ClientPutStategetParent in interface ClientPutStatepublic void cancel(ClientContext context)
ClientPutStatecancel in interface ClientPutStatepublic boolean isEmpty()
isEmpty in class SendableInsertpublic boolean isCancelled()
SendableRequestisCancelled in class SendableRequestpublic SendableRequestSender getSender(ClientContext context)
SendableRequestgetSender in class SendableRequestcontext - A client context may also be necessary.public RequestClient getClient()
SendableRequestgetClient in class SendableRequestpublic ClientRequester getClientRequest()
SendableRequestgetClientRequest in class SendableRequestpublic java.lang.Object getToken()
ClientPutStategetToken in interface ClientPutStatepublic void tryEncode(ClientContext context)
public long countSendableKeys(ClientContext context)
SendableRequestcountSendableKeys in class SendableRequestpublic long countAllKeys(ClientContext context)
SendableRequestcountAllKeys in class SendableRequestpublic SendableRequestItem chooseKey(KeysFetchingLocally ignored, ClientContext context)
SendableRequestchooseKey in class SendableRequestpublic long getWakeupTime(ClientContext context, long now)
RequestSelectionTreeNodegetWakeupTime in interface RequestSelectionTreeNodegetWakeupTime in interface RandomGrabArrayItemgetWakeupTime in class SendableInsertpublic boolean canWriteClientCache()
canWriteClientCache in class SendableInsertpublic boolean localRequestOnly()
localRequestOnly in class SendableInsertpublic boolean forkOnCacheable()
forkOnCacheable in class SendableInsertpublic void onEncode(SendableRequestItem token, ClientKey key, ClientContext context)
SendableInsertonEncode in class SendableInsertpublic void innerOnResume(ClientContext context) throws InsertException, ResumeFailedException
innerOnResume in class SendableInsertInsertExceptionResumeFailedExceptionpublic void onShutdown(ClientContext context)
ClientPutStateonShutdown in interface ClientPutState