Before we close out this chapter, let's clean up after ourselves:
> (lric:delete pid my-bucket key-3)
ok
> (lric:delete pid book-bucket hhgttg-key)
ok
> (lric:stop pid)
ok
Keep in mind that buckets are like namespaces, not objects; once we have deleted all the keys in a bucket, the bucket will effectively be "deleted".
Once you think you've gotten all the keys, try this:
(io:format "~p~n" `(,(lric:list-buckets client-pid)))
You should see an empty list in the result, no binary bucket names. If you do see bucket names, you've probably got an extry key laying around in it. For any bucket listed in the results, you can list the keys of that bucket. This is not something that should ever be done on a production system, however, since it is intrinsically not an operation that plays to Riak's strengths.
If you have a bucket that was defined like this:
(set my-buck (binary "my-bucket"))
and it shows up in the previous command, you can list the keys that are still defined in the bucket with the following:
(io:format "~p~n" `(,(lric:list-keys client-pid my-buck)))