public final class ListKeys extends StreamableRiakCommand.StreamableRiakCommandWithSameInfo<ListKeys.Response,Namespace,ListKeysOperation.Response>
This command is used to retrieve a list of all keys in a bucket. The response is iterable and contains a list of Locations.
Namespace ns = new Namespace("my_type", "my_bucket");
ListKeys lk = new ListKeys.Builder(ns).build();
ListKeys.Response response = client.execute(lk);
for (Location l : response)
{
System.out.println(l.getKeyAsString());
}
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");
ListKeys lk = new ListKeys.Builder(ns).build();
RiakFuture<ListKeys.StreamingResponse, Namespace> streamFuture =
client.executeAsyncStreaming(lk, 200);
final ListKeys.StreamingResponse streamingResponse = streamFuture.get();
ListKeys.Response response = client.execute(lk);
for (Location l : streamingResponse)
{
System.out.println(l.getKeyAsString());
}
This is a very expensive operation and is not recommended for use on a production system
| Modifier and Type | Class and Description |
|---|---|
static class |
ListKeys.Builder
Used to construct a ListKeys command.
|
static class |
ListKeys.Response |
StreamableRiakCommand.StreamableResponse<T,S>, StreamableRiakCommand.StreamableRiakCommandWithSameInfo<R extends StreamableRiakCommand.StreamableResponse,I,CoreR>GenericRiakCommand.GenericRiakCommandWithSameInfo<R,I,CoreR>| Modifier and Type | Method and Description |
|---|---|
protected ListKeysOperation |
buildCoreOperation(boolean streamResults) |
protected ListKeys.Response |
convertResponse(FutureOperation<ListKeysOperation.Response,?,Namespace> request,
ListKeysOperation.Response coreResponse) |
protected ListKeys.Response |
createResponse(int timeout,
StreamingRiakFuture<ListKeysOperation.Response,Namespace> coreFuture) |
boolean |
equals(Object obj) |
int |
hashCode() |
String |
toString() |
convertInfobuildCoreOperation, executeAsyncStreamingexecuteAsyncexecute, executeprotected ListKeys.Response convertResponse(FutureOperation<ListKeysOperation.Response,?,Namespace> request, ListKeysOperation.Response coreResponse)
convertResponse in class GenericRiakCommand<ListKeys.Response,Namespace,ListKeysOperation.Response,Namespace>protected ListKeys.Response createResponse(int timeout, StreamingRiakFuture<ListKeysOperation.Response,Namespace> coreFuture)
createResponse in class StreamableRiakCommand<ListKeys.Response,Namespace,ListKeysOperation.Response,Namespace>protected ListKeysOperation buildCoreOperation(boolean streamResults)
buildCoreOperation in class StreamableRiakCommand<ListKeys.Response,Namespace,ListKeysOperation.Response,Namespace>Copyright © 2016. All rights reserved.