2015-07-09 00:51:33 +08:00
|
|
|
|
<head></head><body>
|
|
|
|
|
<div>
|
|
|
|
|
Hi,<br>
|
2015-07-22 02:34:47 +08:00
|
|
|
|
<blockquote class="foo">
|
|
|
|
|
On Tue, 2011-03-01 at 18:02 +0530, Abhishek Kona wrote:
|
|
|
|
|
<div>
|
|
|
|
|
> Hi folks <br>
|
|
|
|
|
> <br>
|
|
|
|
|
> What is the best way to clear a Riak bucket of all key, values after
|
|
|
|
|
<br>
|
|
|
|
|
> running a test? <br>
|
|
|
|
|
> I am currently using the Java HTTP API. <br>
|
|
|
|
|
</div>
|
|
|
|
|
</blockquote>
|
2015-07-09 00:51:33 +08:00
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
You can list the keys for the bucket and call delete for each. Or if you
|
|
|
|
|
put the keys (and kept track of them in your test) you can delete them
|
|
|
|
|
one at a time (without incurring the cost of calling list first.)
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Something like:
|
|
|
|
|
<br>
|
|
|
|
|
</p><pre>
|
|
|
|
|
String bucket = "my_bucket";
|
|
|
|
|
BucketResponse bucketResponse = riakClient.listBucket(bucket);
|
|
|
|
|
RiakBucketInfo bucketInfo = bucketResponse.getBucketInfo();
|
|
|
|
|
|
|
|
|
|
for(String key : bucketInfo.getKeys()) {
|
|
|
|
|
riakClient.delete(bucket, key);
|
|
|
|
|
}
|
|
|
|
|
</pre>
|
|
|
|
|
<p></p>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
would do it.
|
|
|
|
|
<br>
|
|
|
|
|
See also
|
|
|
|
|
<br>
|
|
|
|
|
http://wiki.basho.com/REST-API.html#Bucket-operations
|
|
|
|
|
<br>
|
|
|
|
|
which says
|
|
|
|
|
<br>
|
|
|
|
|
"At the moment there is no straightforward way to delete an entire
|
|
|
|
|
Bucket. There is, however, an open ticket for the feature. To delete all
|
|
|
|
|
the keys in a bucket, you’ll need to delete them all individually."
|
|
|
|
|
</p>
|
|
|
|
|
|
2015-07-22 02:34:47 +08:00
|
|
|
|
<blockquote>
|
|
|
|
|
<div>
|
|
|
|
|
> <br>
|
|
|
|
|
> -Abhishek Kona <br>
|
|
|
|
|
> <br>
|
|
|
|
|
> <br>
|
|
|
|
|
> _______________________________________________ <br>
|
|
|
|
|
> riak-users mailing list <br>
|
|
|
|
|
> riak-users@lists.basho.com <br>
|
|
|
|
|
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com <br>
|
|
|
|
|
</div>
|
|
|
|
|
</blockquote>
|
2015-07-09 00:51:33 +08:00
|
|
|
|
<br>
|
|
|
|
|
<br>
|
|
|
|
|
<br>
|
|
|
|
|
<br>
|
|
|
|
|
_______________________________________________
|
|
|
|
|
riak-users mailing list
|
|
|
|
|
riak-users@lists.basho.com
|
|
|
|
|
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
|
|
|
|
|
|
|
|
|
|
</div></body>
|