public class RiakClient extends Object
Constructor and Description |
---|
RiakClient(RiakConfig config) |
RiakClient(RiakConfig config,
String clientId) |
RiakClient(String url) |
RiakClient(String url,
String clientId) |
public RiakClient(RiakConfig config)
public RiakClient(RiakConfig config, String clientId)
public RiakClient(String url)
public RiakConfig getConfig()
public HttpResponse setBucketSchema(String bucket, RiakBucketInfo bucketInfo, RequestMeta meta)
public HttpResponse setBucketSchema(String bucket, RiakBucketInfo bucketInfo)
public BucketResponse getBucketSchema(String bucket, RequestMeta meta)
public HttpResponse resetBucketSchema(String bucket)
public BucketResponse getBucketSchema(String bucket)
public BucketResponse listBucket(String bucket, RequestMeta meta)
public BucketResponse listBucket(String bucket)
public BucketResponse streamBucket(String bucket, RequestMeta meta)
public BucketResponse streamBucket(String bucket)
public StoreResponse store(RiakObject object, RequestMeta meta)
public StoreResponse store(RiakObject object)
public FetchResponse fetchMeta(String bucket, String key, RequestMeta meta)
RiakObject
stored at bucket
and key
.
NOTE: if there a sibling values (HTTP status code 300), then a full
fetch(String, String, RequestMeta)
is executed as well
to get all meta values. Examine the FetchResponse.hasSiblings()
value to determine if you need to perform conflict resolution.
bucket
- The bucket containing the RiakObject
to fetch.key
- The key of the RiakObject
to fetch.meta
- Extra metadata to attach to the request such as an r- value
for the request, HTTP headers, and other query parameters. See
RequestMeta.readParams(int)
.FetchResponse
containing HTTP response information and a
RiakObject
containing only metadata and no value.RiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.public FetchResponse fetchMeta(String bucket, String key)
public FetchResponse fetch(String bucket, String key, RequestMeta meta)
public FetchResponse fetch(String bucket, String key)
public FetchResponse stream(String bucket, String key, RequestMeta meta)
HttpResponseDecorator.close()
on the
return value.bucket
- The bucket containing the RiakObject
to fetch.key
- The key of the RiakObject
to fetch.meta
- Extra metadata to attach to the request such as an r value
for the request, HTTP headers, and other query parameters. See
RequestMeta.readParams().FetchResponse
containing HTTP response
information and the response stream. The HTTP connection must be
closed manually by the user by calling
HttpResponseDecorator.close()
.public FetchResponse stream(String bucket, String key)
public boolean stream(String bucket, String key, StreamHandler handler, RequestMeta meta) throws IOException
IOException
public HttpResponse delete(String bucket, String key, RequestMeta meta)
public HttpResponse delete(String bucket, String key)
public WalkResponse walk(String bucket, String key, String walkSpec, RequestMeta meta)
public WalkResponse walk(String bucket, String key, String walkSpec)
public WalkResponse walk(String bucket, String key, RiakWalkSpec walkSpec)
public MapReduceResponse mapReduce(String job, RequestMeta meta)
public MapReduceResponse mapReduce(String job)
public MapReduceBuilder mapReduceOverBucket(String bucket)
public MapReduceBuilder mapReduceOverObjects(Map<String,Set<String>> objects)
mapReduceOverBucket(String)
, except over a set
of objects instead of a bucket.objects
- A set of objects represented as a map of { bucket : [ list of
keys in bucket ] }MapReduceBuilder
to build the map reduce jobpublic MapReduceBuilder mapReduceOverSearch(String bucket, String search)
mapReduceOverBucket(String)
, except over a
riak-search query instead of a bucket.bucket
- The bucket to perform the riak-search oversearch
- The query that riak-search will executeMapReduceBuilder
to build the map reduce jobpublic RiakExceptionHandler getExceptionHandler()
public void setExceptionHandler(RiakExceptionHandler exceptionHandler)
public org.apache.http.client.HttpClient getHttpClient()
public byte[] getClientId()
public void setClientId(String clientId)
public ListBucketsResponse listBuckets(boolean streaming)
ListBucketsResponse
IOException
org.json.JSONException
public HttpResponse ping()
HttpResponse
with the result of GETpublic HttpResponse stats()
/stats
(status) resource.HttpResponse
with the result of GETpublic IndexResponse index(String bucket, String indexName, String value)
index
with value
bucket
- the bucketindexName
- the name of the index (e.g. 'user_bin')value
- the value of the indexIndexResponse
public IndexResponse index(String bucket, String indexName, long value)
index
with value
bucket
- the bucketindexName
- index name (e.g. 'age_int')value
- an int for the index valueIndexResponse
public IndexResponse index(String bucket, String indexName, String start, String end)
start
to
end
bucket
- the bucketindexName
- the index (e.g. 'username_bin')start
- the start value in a range (e.g 'a')end
- the end value in a range (e.g. 'z')IndexResponse
public IndexResponse index(String bucket, String indexName, long start, long end)
start
to
end
bucket
- the bucketindexName
- the index (e.g. 'age_int')start
- the start value in a range (e.g 16)end
- the end value in a range (e.g. 32)IndexResponse
public IndexResponseV2 index(IndexRequest request)
public Long incrementCounter(String bucket, String counter, long increment, RequestMeta meta)
public Long fetchCounter(String bucket, String counter, RequestMeta meta)
public void shutdown()
Copyright © 2014. All Rights Reserved.