I am trying to use the Riak client for PHP and I cant find a way to get a list of all the buckets in the cluster. The docs on the Riak site say that it has support for it but i cant find any function that will do it.
Asked
Active
Viewed 638 times
2 Answers
1
Here's how you list the buckets with the Riak PHP client:
<?php
require_once('riak-php-client/riak.php');
$client = new RiakClient('127.0.0.1', 8091);
$all_buckets = $client->buckets();
var_dump($all_buckets); // etc
?>

Dmitri Zagidulin
- 1,117
- 9
- 23
0
The documentation does not provide all of the functions. I found the followinf function in the documentation.
/**
* Get all buckets.
* @return array() of RiakBucket objects
*/
function buckets() {
$url = RiakUtils::buildRestPath($this);
$response = RiakUtils::httpRequest('GET', $url.'?buckets=true');
$response_obj = json_decode($response[1]);
$buckets = array();
foreach($response_obj->buckets as $name) {
$buckets[] = $this->bucket($name);
}
return $buckets;
}

WojonsTech
- 1,277
- 1
- 13
- 28