On Thu, Mar 14, 2013 at 11:25 PM, Kevin Burton <rkevinbur...@charter.net> wrote:
> This sample calls ‘createBucket’. First what is the difference between
> ‘createBucket’ and ‘fetchBucket’? I have an existing bucket so I don’t want
> to create a new one and thereby remove the old one. So I felt that
> ‘fetchBucket’ would be the call I should make. The problem is that
> ‘fetchBucket’ returns a ‘FetchBucket’ object that doesn’t have the same
> methods as the ‘Bucket’ returned by createBucket. I would just like to query
> the bucket using a key. But that simple operation appears to be unavailable
> with the ‘FetchBucket’ object. Ideas?

For the most part all of this is simply semantics to have the Java API
model interacting with Riak in some logical fashion. Nothing ever
"removes" a bucket from Riak. The only difference between a
FetchBucket and a WriteBucket is whether or not the bucket properties
are written to Riak when you call execture().

Calling execute() on a FetchBucket queries Riak for the bucket
properties and returns a Bucket object. If you don't need to read the
properties you can call .lazyLoadBucketProperties() on the FetchBucket
prior to calling execute() and it will not query Riak at all (unless
you then call any of the property getters (e.g. getR() ) on the
returned Bucket).

Calling execute() on a WriteBucket (which is returned by
IRiakClient.createBucket() and IRiakClient.updateBucket() - they are
exactly the same thing) does a write to Riak of the properties
specified then a subsequent read of them back from Riak, returning a
Bucket object. Again, the read can be avoided or postponed using
.lazyLoadBucketProperties() prior to execute().

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to