public abstract class BaseManifestPutter extends ManifestPutter
Base class for site insertion. This class contains all the insert logic, but not any 'pack logic'. The pack logic have to be implement in a subclass in makePutHandlers.
Internal container redirect URIs: The internal container URIs should be always redirects to CHKs, not just include the metadata into manifest only. The (assumed) default behavior is the reuse of containers between editions, also ArchiveManger want to have a URI given, not Metadata. This rule also makes site update code/logic much more easier.
| Modifier and Type | Class and Description |
|---|---|
protected class |
BaseManifestPutter.ContainerBuilder |
protected class |
BaseManifestPutter.FreeFormBuilder |
protected class |
BaseManifestPutter.ManifestBuilder |
| Modifier and Type | Field and Description |
|---|---|
protected int |
minSuccessFetchBlocks
The number of blocks that will be needed to fetch the data.
|
blockSetFinalized, cancelled, client, creationTime, failedBlocks, fatallyFailedBlocks, latestFailure, latestSuccess, minSuccessBlocks, priorityClass, realTimeFlag, sentToNetwork, successfulBlocks, totalBlocks| Constructor and Description |
|---|
BaseManifestPutter(ClientPutCallback cb,
java.util.HashMap<java.lang.String,java.lang.Object> manifestElements,
short prioClass,
FreenetURI target,
java.lang.String defaultName,
InsertContext ctx,
boolean randomiseCryptoKeys,
byte[] forceCryptoKey,
ClientContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBlock()
Add a block to our estimate of the total.
|
void |
addBlocks(int num)
Add several blocks to our estimate of the total.
|
void |
addMustSucceedBlocks(int blocks)
Add one or more blocks to the number of requires blocks, and don't notify the clients.
|
void |
addRedundantBlocksInsert(int blocks)
Add one or more blocks to the number of requires blocks, and don't notify the clients.
|
void |
blockSetFinalized(ClientContext context)
The set of blocks has been finalised, total will not change any
more.
|
static java.util.HashMap<java.lang.String,java.lang.Object> |
bucketsByNameToManifestEntries(java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName) |
void |
cancel(ClientContext context)
Cancel the request.
|
int |
countFiles() |
static ManifestElement[] |
flatten(java.util.HashMap<java.lang.String,java.lang.Object> manifestElements) |
static void |
flatten(java.util.HashMap<java.lang.String,java.lang.Object> manifestElements,
java.util.List<ManifestElement> v,
java.lang.String prefix) |
protected ClientBaseCallback |
getCallback() |
int |
getMinSuccessFetchBlocks() |
protected BaseManifestPutter.FreeFormBuilder |
getRootBuilder() |
protected BaseManifestPutter.ContainerBuilder |
getRootContainer() |
byte[] |
getSplitfileCryptoKey() |
FreenetURI |
getURI()
Get the URI for the request or insert.
|
protected ClientMetadata |
guessMime(java.lang.String name,
ManifestElement me) |
protected ClientMetadata |
guessMime(java.lang.String name,
java.lang.String mimetype) |
void |
innerNotifyClients(ClientContext context)
Notify clients, usually via a SplitfileProgressEvent, of the current progress.
|
protected void |
innerOnResume(ClientContext context)
Called by onResume() once and only once after restarting.
|
protected void |
innerToNetwork(ClientContext context)
Notify clients that a request has gone to the network, for the first time, i.e.
|
boolean |
isFinished()
Is the request or insert completed (succeeded, failed, or
cancelled, which is a kind of failure)?
|
BaseManifestPutter.ContainerBuilder |
makeArchive() |
protected abstract void |
makePutHandlers(java.util.HashMap<java.lang.String,java.lang.Object> manifestElements,
java.lang.String defaultName)
Implement the pack logic.
|
protected void |
onFetchable(freenet.client.async.BaseManifestPutter.PutHandler handler) |
void |
onShutdown(ClientContext context)
Called just before the final write when shutting down the node.
|
void |
onTransition(ClientGetState oldState,
ClientGetState newState,
ClientContext context) |
void |
onTransition(ClientPutState from,
ClientPutState to,
ClientContext context) |
void |
start(ClientContext context) |
long |
totalSize() |
dumpcancel, clearCountersOnRestart, completedBlock, failedBlock, failedBlock, fatallyFailedBlock, getAll, getClient, getClientDetail, getClientDetail, getLatestFailure, getLatestSuccess, getPriorityClass, getSchedulerGroup, getTotalBlocks, hashCode, isCancelled, isCurrentState, notifyClients, onResume, persistent, realTimeFlag, resetBlocks, setPriorityClass, toNetworkprotected int minSuccessFetchBlocks
public BaseManifestPutter(ClientPutCallback cb, java.util.HashMap<java.lang.String,java.lang.Object> manifestElements, short prioClass, FreenetURI target, java.lang.String defaultName, InsertContext ctx, boolean randomiseCryptoKeys, byte[] forceCryptoKey, ClientContext context) throws TooManyFilesInsertException
TooManyFilesInsertExceptionpublic void start(ClientContext context) throws InsertException
start in class ManifestPutterInsertExceptionprotected abstract void makePutHandlers(java.util.HashMap<java.lang.String,java.lang.Object> manifestElements,
java.lang.String defaultName)
throws TooManyFilesInsertException
manifestElements - A map from String to either ManifestElement or another String. This is the
site structure, which will be split into containers and/or external inserts by the method.TooManyFilesInsertExceptionpublic FreenetURI getURI()
ClientRequestergetURI in class ClientRequesterpublic boolean isFinished()
ClientRequesterisFinished in class ClientRequesterpublic byte[] getSplitfileCryptoKey()
getSplitfileCryptoKey in class ManifestPutterpublic void cancel(ClientContext context)
ClientRequestercancel in class ClientRequestercontext - The ClientContext object including essential but
non-persistent objects such as the schedulers.public void addBlock()
ClientRequesteraddBlock in class ClientRequesterpublic void addBlocks(int num)
ClientRequesteraddBlocks in class ClientRequesterpublic void addMustSucceedBlocks(int blocks)
addMustSucceedBlocks in class ClientRequesterpublic void addRedundantBlocksInsert(int blocks)
addRedundantBlocksInsert in class ClientRequesterpublic void innerNotifyClients(ClientContext context)
ClientRequesterinnerNotifyClients in class ClientRequesterpublic int getMinSuccessFetchBlocks()
getMinSuccessFetchBlocks in class BaseClientPutterpublic void blockSetFinalized(ClientContext context)
ClientRequesterblockSetFinalized in class ClientRequestercontext - The ClientContext object including essential but
non-persistent objects such as the schedulers.public int countFiles()
countFiles in class ManifestPutterpublic long totalSize()
totalSize in class ManifestPutterprotected void onFetchable(freenet.client.async.BaseManifestPutter.PutHandler handler)
public void onTransition(ClientGetState oldState, ClientGetState newState, ClientContext context)
onTransition in class ClientRequesterpublic void onTransition(ClientPutState from, ClientPutState to, ClientContext context)
onTransition in class BaseClientPutterprotected void innerToNetwork(ClientContext context)
ClientRequesterinnerToNetwork in class ClientRequesterprotected final ClientMetadata guessMime(java.lang.String name, ManifestElement me)
protected final ClientMetadata guessMime(java.lang.String name, java.lang.String mimetype)
public BaseManifestPutter.ContainerBuilder makeArchive()
protected BaseManifestPutter.ContainerBuilder getRootContainer()
protected BaseManifestPutter.FreeFormBuilder getRootBuilder()
protected ClientBaseCallback getCallback()
getCallback in class ClientRequesterpublic static java.util.HashMap<java.lang.String,java.lang.Object> bucketsByNameToManifestEntries(java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName)
public static ManifestElement[] flatten(java.util.HashMap<java.lang.String,java.lang.Object> manifestElements)
public static void flatten(java.util.HashMap<java.lang.String,java.lang.Object> manifestElements,
java.util.List<ManifestElement> v,
java.lang.String prefix)
public void onShutdown(ClientContext context)
ClientRequesteronShutdown in class ClientRequesterprotected void innerOnResume(ClientContext context) throws ResumeFailedException
ClientRequesterinnerOnResume in class ClientRequesterResumeFailedException