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 HighLevelSimpleClient
clone
in class java.lang.Object
public void setMaxLength(long maxLength)
HighLevelSimpleClient
setMaxLength
in interface HighLevelSimpleClient
public void setMaxIntermediateLength(long maxIntermediateLength)
HighLevelSimpleClient
setMaxIntermediateLength
in interface HighLevelSimpleClient
public FetchResult fetch(FreenetURI uri) throws FetchException
fetch
in interface HighLevelSimpleClient
FetchException
- If there is an error fetching the datapublic FetchResult fetchFromMetadata(Bucket initialMetadata) throws FetchException
fetchFromMetadata
in interface HighLevelSimpleClient
FetchException
- If there is an error fetching the datapublic FetchResult fetch(FreenetURI uri, long overrideMaxSize) throws FetchException
HighLevelSimpleClient
fetch
in interface HighLevelSimpleClient
overrideMaxSize
- The maximum size in bytes of the return data or any intermediary data processed
to obtain the final output (e.g. containers).FetchException
public FetchResult fetch(FreenetURI uri, long overrideMaxSize, RequestClient clientContext) throws FetchException
HighLevelSimpleClient
fetch
in interface HighLevelSimpleClient
clientContext
- 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.FetchException
public ClientGetter fetch(FreenetURI uri, long maxSize, ClientGetCallback callback, FetchContext fctx) throws FetchException
HighLevelSimpleClient
fetch
in interface HighLevelSimpleClient
maxSize
- 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.FetchException
public ClientGetter fetch(FreenetURI uri, long maxSize, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException
HighLevelSimpleClient
fetch
in interface HighLevelSimpleClient
callback
- 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.FetchException
public ClientGetter fetch(FreenetURI uri, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException
HighLevelSimpleClient
fetch
in interface HighLevelSimpleClient
callback
- 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.FetchException
public ClientGetter fetchFromMetadata(Bucket initialMetadata, ClientGetCallback callback, FetchContext fctx, short prio) throws FetchException
HighLevelSimpleClient
fetchFromMetadata
in interface HighLevelSimpleClient
callback
- 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.FetchException
public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, java.lang.String filenameHint) throws InsertException
HighLevelSimpleClient
insert
in interface HighLevelSimpleClient
filenameHint
- 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
HighLevelSimpleClient
insert
in interface HighLevelSimpleClient
filenameHint
- 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
InsertException
public FreenetURI insert(InsertBlock insert, java.lang.String filenameHint, short priority, InsertContext ctx) throws InsertException
HighLevelSimpleClient
insert
in interface HighLevelSimpleClient
filenameHint
- 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
InsertException
public FreenetURI insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, short priority, InsertContext ctx, byte[] forceCryptoKey) throws InsertException
InsertException
public ClientPutter insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, InsertContext ctx, ClientPutCallback cb) throws InsertException
HighLevelSimpleClient
insert
in interface HighLevelSimpleClient
isMetadata
- 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.InsertException
public ClientPutter insert(InsertBlock insert, java.lang.String filenameHint, boolean isMetadata, InsertContext ctx, ClientPutCallback cb, short priority) throws InsertException
HighLevelSimpleClient
insert
in interface HighLevelSimpleClient
isMetadata
- 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.InsertException
public FreenetURI insertRedirect(FreenetURI insertURI, FreenetURI targetURI) throws InsertException
HighLevelSimpleClient
insertRedirect
in interface HighLevelSimpleClient
InsertException
public FreenetURI insertManifest(FreenetURI insertURI, java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName, java.lang.String defaultName) throws InsertException
HighLevelSimpleClient
insertManifest
in interface HighLevelSimpleClient
InsertException
public FreenetURI insertManifest(FreenetURI insertURI, java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName, java.lang.String defaultName, short priorityClass) throws InsertException
HighLevelSimpleClient
insertManifest
in interface HighLevelSimpleClient
InsertException
public FreenetURI insertManifest(FreenetURI insertURI, java.util.HashMap<java.lang.String,java.lang.Object> bucketsByName, java.lang.String defaultName, short priorityClass, byte[] forceCryptoKey) throws InsertException
HighLevelSimpleClient
insertManifest
in interface HighLevelSimpleClient
InsertException
public void addEventHook(ClientEventListener listener)
HighLevelSimpleClient
addEventHook
in interface HighLevelSimpleClient
public FetchContext getFetchContext()
HighLevelSimpleClient
getFetchContext
in interface HighLevelSimpleClient
public FetchContext getFetchContext(long overrideMaxSize)
getFetchContext
in interface HighLevelSimpleClient
public FetchContext getFetchContext(long overrideMaxSize, java.lang.String schemeHostAndPort)
getFetchContext
in interface HighLevelSimpleClient
public static FetchContext makeDefaultFetchContext(long maxLength, long maxTempLength, BucketFactory bucketFactory, SimpleEventProducer eventProducer)
public InsertContext getInsertContext(boolean forceNonPersistent)
HighLevelSimpleClient
getInsertContext
in interface HighLevelSimpleClient
forceNonPersistent
- 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)
HighLevelSimpleClient
generateKeyPair
in interface HighLevelSimpleClient
docName
- The document namepublic void prefetch(FreenetURI uri, long timeout, long maxSize, java.util.Set<java.lang.String> allowedTypes)
HighLevelSimpleClient
prefetch
in interface HighLevelSimpleClient
allowedTypes
- 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)
HighLevelSimpleClient
prefetch
in interface HighLevelSimpleClient
allowedTypes
- Kill the request if the MIME type is not one of these types. Normally null.public boolean persistent()
RequestClient
persistent
in interface RequestClient
public boolean realTimeFlag()
RequestClient
realTimeFlag
in interface RequestClient