So the way I understand it is that under the covers 'createBucket' when called on a bucket that already exists essentially reverts to the functionality of 'fetchBucket'? While we are on the subject, is there an API to actually delete a bucket with the Java driver?
-----Original Message----- From: Brian Roach [mailto:[email protected]] Sent: Wednesday, March 20, 2013 9:47 AM To: Kevin Burton Cc: [email protected] Subject: Re: Java driver createBucket/fetchBucket On Thu, Mar 14, 2013 at 11:25 PM, Kevin Burton <[email protected]> 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 [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
