public class BucketIndexQuery extends BinIndexQuery
A BucketIndexQuery is used when you want to fetch all the keys for a bucket. Only a namespace is needed.
Namespace ns = new Namespace("my_type", "my_bucket");
BucketIndexQuery q = new BucketIndexQuery.Builder(ns).build();
RawIndexquery.Response resp = client.execute(q);
You can also stream the results back before the operation is fully complete.
This reduces the time between executing the operation and seeing a result,
and reduces overall memory usage if the iterator is consumed quickly enough.
The result iterable can only be iterated once though.
If the thread is interrupted while the iterator is polling for more results,
a RuntimeException
will be thrown.
Namespace ns = new Namespace("my_type", "my_bucket");
BucketIndexQuery q = new BucketIndexQuery.Builder(ns).build();
RiakFuture<BinIndexQuery.StreamingResponse, BinIndexQuery> streamingFuture =
client.executeAsyncStreaming(q, 200);
BinIndexQuery.StreamingResponse streamingResponse = streamingFuture.get();
for (BinIndexQuery.Response.Entry e : streamingResponse)
{
System.out.println(e.getRiakObjectLocation().getKey().toString());
}
// Wait for the command to fully finish.
streamingFuture.await();
// The StreamingResponse will also contain the continuation, if the operation returned one.
streamingResponse.getContinuation();
Modifier and Type | Class and Description |
---|---|
static class |
BucketIndexQuery.Builder |
BinIndexQuery.Init<S,T extends BinIndexQuery.Init<S,T>>, BinIndexQuery.Response
SecondaryIndexQuery.GatherableResponseCreator<T,R extends SecondaryIndexQuery.Response<T,?>>, SecondaryIndexQuery.IndexConverter<T>, SecondaryIndexQuery.StreamableResponseCreator<T,R extends SecondaryIndexQuery.Response<T,?>>, SecondaryIndexQuery.Type
StreamableRiakCommand.StreamableResponse<T,S>, StreamableRiakCommand.StreamableRiakCommandWithSameInfo<R extends StreamableRiakCommand.StreamableResponse,I,CoreR>
GenericRiakCommand.GenericRiakCommandWithSameInfo<R,I,CoreR>
continuation, coverageContext, end, indexName, match, maxResults, namespace, paginationSort, returnBody, returnTerms, start, termFilter, timeout
equals, getConverter, hashCode
buildCoreOperation, convertInfo, convertResponse, createResponse, getContinuation, getIndexName, getMatchValue, getMaxResults, getNamespace, getPaginationSort, getRangeEnd, getRangeStart, getReturnKeyAndIndex, getTermFilter, getTimeout, toString
buildCoreOperation, executeAsyncStreaming
executeAsync
execute, execute
Copyright © 2016. All rights reserved.