public class HighLevelSimpleClientImpl extends java.lang.Object implements HighLevelSimpleClient, RequestClient, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static int |
EXTRA_INSERTS_SINGLE_BLOCK |
static int |
EXTRA_INSERTS_SPLITFILE_HEADER |
static int |
SPLITFILE_BLOCKS_PER_SEGMENT |
static int |
SPLITFILE_CHECK_BLOCKS_PER_SEGMENT |
static int |
SPLITFILE_SCALING_BLOCKS_PER_SEGMENT |
| Constructor and Description |
|---|
HighLevelSimpleClientImpl(HighLevelSimpleClientImpl hlsc) |
HighLevelSimpleClientImpl(NodeClientCore node,
BucketFactory bf,
RandomSource r,
short priorityClass,
boolean forceDontIgnoreTooManyPathComponents,
boolean realTimeFlag) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventHook(ClientEventListener listener)
Add a ClientEventListener.
|
HighLevelSimpleClientImpl |
clone() |
FetchResult |
fetch(FreenetURI uri)
Fetch a key.
|
ClientGetter |
fetch(FreenetURI uri,
ClientGetCallback callback,
FetchContext fctx,
short prio)
Non-blocking fetch of a URI with a configurable max-size (in bytes), context object, callback and context.
|
FetchResult |
fetch(FreenetURI uri,
long overrideMaxSize)
Blocking fetch of a URI with a configurable max-size.
|
ClientGetter |
fetch(FreenetURI uri,
long maxSize,
ClientGetCallback callback,
FetchContext fctx)
Non-blocking fetch of a URI with a configurable max-size (in bytes), context object, callback and context.
|
ClientGetter |
fetch(FreenetURI uri,
long maxSize,
ClientGetCallback callback,
FetchContext fctx,
short prio)
Non-blocking fetch of a URI with a configurable max-size (in bytes), context object, callback and context.
|
FetchResult |
fetch(FreenetURI uri,
long overrideMaxSize,
RequestClient clientContext)
Blocking fetch of a URI with a configurable max-size and context object.
|
FetchResult |
fetchFromMetadata(Bucket initialMetadata)
Fetch a key.
|
ClientGetter |
fetchFromMetadata(Bucket initialMetadata,
ClientGetCallback callback,
FetchContext fctx,
short prio)
Non-blocking fetch of a URI with a configurable max-size (in bytes), context object, callback and context.
|
FreenetURI[] |
generateKeyPair(java.lang.String docName)
Generates a new key pair, consisting of the insert URI at index 0 and the
request URI at index 1.
|
FetchContext |
getFetchContext()
Get the FetchContext so you can customise the search process.
|
FetchContext |
getFetchContext(long overrideMaxSize) |
FetchContext |
getFetchContext(long overrideMaxSize,
java.lang.String schemeHostAndPort) |
InsertContext |
getInsertContext(boolean forceNonPersistent)
Get an InsertContext.
|
FreenetURI |
insert(InsertBlock insert,
boolean getCHKOnly,
java.lang.String filenameHint)
Blocking insert.
|
FreenetURI |
insert(InsertBlock insert,
boolean getCHKOnly,
java.lang.String filenameHint,
boolean isMetadata,
short priority) |
FreenetURI |
insert(InsertBlock insert,
boolean getCHKOnly,
java.lang.String filenameHint,
short priority)
Blocking insert.
|
ClientPutter |
insert(InsertBlock insert,
java.lang.String filenameHint,
boolean isMetadata,
InsertContext ctx,
ClientPutCallback cb)
Non-blocking insert.
|
ClientPutter |
insert(InsertBlock insert,
java.lang.String filenameHint,
boolean isMetadata,
InsertContext ctx,
ClientPutCallback cb,
short priority)
Non-blocking insert.
|
FreenetURI |
insert(InsertBlock insert,
java.lang.String filenameHint,
boolean isMetadata,
short priority,
InsertContext ctx) |
FreenetURI |
insert(InsertBlock insert,
java.lang.String filenameHint,
boolean isMetadata,
short priority,
InsertContext ctx,
byte[] forceCryptoKey) |
FreenetURI |
insert(InsertBlock insert,
java.lang.String filenameHint,
short priority,
InsertContext ctx)
Blocking insert.
|
FreenetURI |
insertManifest(FreenetURI insertURI,
java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName,
java.lang.String defaultName)
Blocking insert of multiple files as a manifest (or zip manifest, etc).
|
FreenetURI |
insertManifest(FreenetURI insertURI,
java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName,
java.lang.String defaultName,
short priorityClass)
Blocking insert of multiple files as a manifest (or zip manifest, etc).
|
FreenetURI |
insertManifest(FreenetURI insertURI,
java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName,
java.lang.String defaultName,
short priorityClass,
byte[] forceCryptoKey)
Blocking insert of multiple files as a manifest, with a crypto key override.
|
FreenetURI |
insertRedirect(FreenetURI insertURI,
FreenetURI targetURI)
Blocking insert of a redirect.
|
static FetchContext |
makeDefaultFetchContext(long maxLength,
long maxTempLength,
BucketFactory bucketFactory,
SimpleEventProducer eventProducer) |
static InsertContext |
makeDefaultInsertContext(BucketFactory bucketFactory,
SimpleEventProducer eventProducer) |
boolean |
persistent()
Is this request persistent? **Must not change!**
|
void |
prefetch(FreenetURI uri,
long timeout,
long maxSize,
java.util.Set<java.lang.String> allowedTypes)
Prefetch a key at a very low priority.
|
void |
prefetch(FreenetURI uri,
long timeout,
long maxSize,
java.util.Set<java.lang.String> allowedTypes,
short prio)
Prefetch a key at the given priority.
|
boolean |
realTimeFlag()
Send the request with the real time flag enabled? Real-time requests are given
a higher priority in data transfers, but fewer of them are accepted.
|
void |
setMaxIntermediateLength(long maxIntermediateLength)
Set the maximum length of any intermediate data, e.g.
|
void |
setMaxLength(long maxLength)
Set the maximum length of the fetched data.
|
public static final int SPLITFILE_SCALING_BLOCKS_PER_SEGMENT
public static final int SPLITFILE_BLOCKS_PER_SEGMENT
public static final int SPLITFILE_CHECK_BLOCKS_PER_SEGMENT
public static final int EXTRA_INSERTS_SINGLE_BLOCK
public static final int EXTRA_INSERTS_SPLITFILE_HEADER
public HighLevelSimpleClientImpl(NodeClientCore node, BucketFactory bf, RandomSource r, short priorityClass, boolean forceDontIgnoreTooManyPathComponents, boolean realTimeFlag)
public HighLevelSimpleClientImpl(HighLevelSimpleClientImpl hlsc)
public HighLevelSimpleClientImpl clone()
clone in interface HighLevelSimpleClientclone in class java.lang.Objectpublic void setMaxLength(long maxLength)
HighLevelSimpleClientsetMaxLength in interface HighLevelSimpleClientpublic void setMaxIntermediateLength(long maxIntermediateLength)
HighLevelSimpleClientsetMaxIntermediateLength in interface HighLevelSimpleClientpublic FetchResult fetch(FreenetURI uri) throws FetchException
fetch in interface HighLevelSimpleClientFetchException - If there is an error fetching the datapublic FetchResult fetchFromMetadata(Bucket initialMetadata) throws FetchException
fetchFromMetadata in interface HighLevelSimpleClientFetchException - If there is an error fetching the datapublic FetchResult fetch(FreenetURI uri, long overrideMaxSize) throws FetchException
HighLevelSimpleClientfetch in interface HighLevelSimpleClientoverrideMaxSize - The maximum size in bytes of the return data or any intermediary data processed
to obtain the final output (e.g. containers).FetchExceptionpublic FetchResult fetch(FreenetURI uri, long overrideMaxSize, RequestClient clientContext) throws FetchException
HighLevelSimpleClientfetch in interface HighLevelSimpleClientclientContext - Used mainly for scheduling, we round-robin between request clients within a given
priority and retry count. Also indicates whether the request is persistent, and if so, can remove it.FetchExceptionpublic ClientGetter fetch(FreenetURI uri, long maxSize, ClientGetCallback callback, FetchContext fctx) throws FetchException
HighLevelSimpleClientfetch in interface HighLevelSimpleClientmaxSize - IGNORED. FIXME DEPRECATEcallback - Will be called when the request completes, fails, etc. If the request is persistent
this will be called on the database thread with a container parameter.fctx - Fetch context so you can customise the search process.FetchExceptionpublic ClientGetter fetch(FreenetURI uri, long maxSize, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException
HighLevelSimpleClientfetch in interface HighLevelSimpleClientcallback - Will be called when the request completes, fails, etc. If the request is persistent
this will be called on the database thread with a container parameter.fctx - Fetch context so you can customise the search process.prio - What priority to start at. It is much more efficient to specify it here than to change it later.FetchExceptionpublic ClientGetter fetch(FreenetURI uri, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException
HighLevelSimpleClientfetch in interface HighLevelSimpleClientcallback - Will be called when the request completes, fails, etc. If the request is persistent
this will be called on the database thread with a container parameter.fctx - Fetch context so you can customise the search process.FetchExceptionpublic ClientGetter fetchFromMetadata(Bucket initialMetadata, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException
HighLevelSimpleClientfetchFromMetadata in interface HighLevelSimpleClientcallback - Will be called when the request completes, fails, etc. If the request is persistent
this will be called on the database thread with a container parameter.fctx - Fetch context so you can customise the search process.FetchExceptionpublic FreenetURI insert(InsertBlock insert, boolean getCHKOnly, java.lang.String filenameHint) throws InsertException
HighLevelSimpleClientinsert in interface HighLevelSimpleClientfilenameHint - If set, insert a single-file manifest containing only this file, under the given filename.InsertException - If there is an error inserting the datapublic FreenetURI insert(InsertBlock insert, boolean getCHKOnly, java.lang.String filenameHint, short priority) throws InsertException
HighLevelSimpleClientinsert in interface HighLevelSimpleClientfilenameHint - If set, insert a single-file manifest containing only this file, under the given filename.InsertException - If there is an error inserting the datapublic FreenetURI insert(InsertBlock insert, boolean getCHKOnly, java.lang.String filenameHint, boolean isMetadata, short priority) throws InsertException
InsertExceptionpublic FreenetURI insert(InsertBlock insert, java.lang.String filenameHint, short priority, InsertContext ctx) throws InsertException
HighLevelSimpleClientinsert in interface HighLevelSimpleClientfilenameHint - If set, insert a single-file manifest containing only this file, under the given filename.InsertException - If there is an error inserting the datapublic FreenetURI insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, short priority, InsertContext ctx) throws InsertException
InsertExceptionpublic FreenetURI insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, short priority, InsertContext ctx, byte[] forceCryptoKey) throws InsertException
InsertExceptionpublic ClientPutter insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, InsertContext ctx, ClientPutCallback cb) throws InsertException
HighLevelSimpleClientinsert in interface HighLevelSimpleClientisMetadata - If true, insert metadata.ctx - Insert context so you can customise the insertion process.cb - Will be called when the insert completes. If the request is persistent
this will be called on the database thread with a container parameter.InsertExceptionpublic ClientPutter insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, InsertContext ctx, ClientPutCallback cb, short priority) throws InsertException
HighLevelSimpleClientinsert in interface HighLevelSimpleClientisMetadata - If true, insert metadata.ctx - Insert context so you can customise the insertion process.cb - Will be called when the insert completes. If the request is persistent
this will be called on the database thread with a container parameter.InsertExceptionpublic FreenetURI insertRedirect(FreenetURI insertURI, FreenetURI targetURI) throws InsertException
HighLevelSimpleClientinsertRedirect in interface HighLevelSimpleClientInsertExceptionpublic FreenetURI insertManifest(FreenetURI insertURI, java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName, java.lang.String defaultName) throws InsertException
HighLevelSimpleClientinsertManifest in interface HighLevelSimpleClientInsertExceptionpublic FreenetURI insertManifest(FreenetURI insertURI, java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName, java.lang.String defaultName, short priorityClass) throws InsertException
HighLevelSimpleClientinsertManifest in interface HighLevelSimpleClientInsertExceptionpublic FreenetURI insertManifest(FreenetURI insertURI, java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName, java.lang.String defaultName, short priorityClass, byte[] forceCryptoKey) throws InsertException
HighLevelSimpleClientinsertManifest in interface HighLevelSimpleClientInsertExceptionpublic void addEventHook(ClientEventListener listener)
HighLevelSimpleClientaddEventHook in interface HighLevelSimpleClientpublic FetchContext getFetchContext()
HighLevelSimpleClientgetFetchContext in interface HighLevelSimpleClientpublic FetchContext getFetchContext(long overrideMaxSize)
getFetchContext in interface HighLevelSimpleClientpublic FetchContext getFetchContext(long overrideMaxSize, java.lang.String schemeHostAndPort)
getFetchContext in interface HighLevelSimpleClientpublic static FetchContext makeDefaultFetchContext(long maxLength, long maxTempLength, BucketFactory bucketFactory, SimpleEventProducer eventProducer)
public InsertContext getInsertContext(boolean forceNonPersistent)
HighLevelSimpleClientgetInsertContext in interface HighLevelSimpleClientforceNonPersistent - If true, force the request to use the non-persistent
bucket pool.public static InsertContext makeDefaultInsertContext(BucketFactory bucketFactory, SimpleEventProducer eventProducer)
public FreenetURI[] generateKeyPair(java.lang.String docName)
HighLevelSimpleClientgenerateKeyPair in interface HighLevelSimpleClientdocName - The document namepublic void prefetch(FreenetURI uri, long timeout, long maxSize, java.util.Set<java.lang.String> allowedTypes)
HighLevelSimpleClientprefetch in interface HighLevelSimpleClientallowedTypes - Kill the request if the MIME type is not one of these types. Normally null.public void prefetch(FreenetURI uri, long timeout, long maxSize, java.util.Set<java.lang.String> allowedTypes, short prio)
HighLevelSimpleClientprefetch in interface HighLevelSimpleClientallowedTypes - Kill the request if the MIME type is not one of these types. Normally null.public boolean persistent()
RequestClientpersistent in interface RequestClientpublic boolean realTimeFlag()
RequestClientrealTimeFlag in interface RequestClient