public final class ListBuckets extends StreamableRiakCommand.StreamableRiakCommandWithSameInfo<ListBuckets.Response,BinaryValue,ListBucketsOperation.Response>
ListBuckets lb = new ListBuckets.Builder("my_type").build();
ListBuckets.Response resp = client.execute(lb);
for (Namespace ns : response)
{
System.out.println(ns.getBucketName());
}
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.
ListBuckets lb = new ListBuckets.Builder("my_type").build();
final RiakFuture<ListBuckets.StreamingResponse, BinaryValue> streamFuture =
client.executeAsyncStreaming(lb, 200);
final ListBuckets.StreamingResponse streamingResponse = streamFuture.get();
for (Namespace ns : streamingResponse)
{
System.out.println(ns.getBucketName());
}
Modifier and Type | Class and Description |
---|---|
static class |
ListBuckets.Builder
Builder for a ListBuckets command.
|
static class |
ListBuckets.Response
A response from a ListBuckets command.
|
StreamableRiakCommand.StreamableResponse<T,S>, StreamableRiakCommand.StreamableRiakCommandWithSameInfo<R extends StreamableRiakCommand.StreamableResponse,I,CoreR>
GenericRiakCommand.GenericRiakCommandWithSameInfo<R,I,CoreR>
Modifier and Type | Method and Description |
---|---|
protected ListBucketsOperation |
buildCoreOperation(boolean streamResults) |
protected ListBuckets.Response |
convertResponse(FutureOperation<ListBucketsOperation.Response,?,BinaryValue> request,
ListBucketsOperation.Response coreResponse) |
protected ListBuckets.Response |
createResponse(int timeout,
StreamingRiakFuture<ListBucketsOperation.Response,BinaryValue> coreFuture) |
convertInfo
buildCoreOperation, executeAsyncStreaming
executeAsync
execute, execute
protected ListBuckets.Response convertResponse(FutureOperation<ListBucketsOperation.Response,?,BinaryValue> request, ListBucketsOperation.Response coreResponse)
convertResponse
in class GenericRiakCommand<ListBuckets.Response,BinaryValue,ListBucketsOperation.Response,BinaryValue>
protected ListBuckets.Response createResponse(int timeout, StreamingRiakFuture<ListBucketsOperation.Response,BinaryValue> coreFuture)
createResponse
in class StreamableRiakCommand<ListBuckets.Response,BinaryValue,ListBucketsOperation.Response,BinaryValue>
protected ListBucketsOperation buildCoreOperation(boolean streamResults)
buildCoreOperation
in class StreamableRiakCommand<ListBuckets.Response,BinaryValue,ListBucketsOperation.Response,BinaryValue>
Copyright © 2016. All rights reserved.