public class FetchBucket extends Object implements RiakOperation<Bucket>
RiakOperation that gets a Bucket from Riak.
Calls the underlying RiakClients fetch method via the Retrier
attempt method, builds a Bucket from the response.
Example:
final String bucketName = "userAccounts";
// fetch a bucket
Bucket b = client.fetchBucket(bucketName).execute();
// use the bucket
IRiakObject o = b.store("k", "v").execute();
| Constructor and Description |
|---|
FetchBucket(RawClient client,
String bucket,
Retrier retrier)
Create a FetchBucket that delegates to the provided
RawClient. |
| Modifier and Type | Method and Description |
|---|---|
Bucket |
execute()
Execute the fetch operation using the RawClient
|
FetchBucket |
lazyLoadBucketProperties()
Prior to the addition of this method there was no way to prevent
execute() from fetching the BucketProperties from Riak. |
FetchBucket |
withRetrier(Retrier retrier)
Provide a
Retrier to use for the fetch operation. |
public Bucket execute() throws RiakRetryFailedException
execute in interface RiakOperation<Bucket>Bucket configured to use this instances RawClient and Retrier for its operationsRiakRetryFailedException - if the Retrier throws RiakRetryFailedExceptionpublic FetchBucket withRetrier(Retrier retrier)
Retrier to use for the fetch operation.retrier - the Retrier to usepublic FetchBucket lazyLoadBucketProperties()
execute() from fetching the BucketProperties from Riak.
Calling this prior to execute() allows you to defer fetching
the bucket properties for this bucket from Riak
until they are required by one of the Bucket methods that
accesses them (e.g. BucketProperties.getR() ). If none of those methods are
called then they are never retrieved.
Copyright © 2014. All Rights Reserved.