basho / riak-php-client

PHP clients for Riak
Apache License 2.0
160 stars 69 forks source link

No support for listing keys [JIRA: CLIENTS-921] #124

Closed kodekraft closed 7 years ago

kodekraft commented 7 years ago

I need to be able to list the keys in a bucket similar to the HTTP API examples: GET /buckets/bucket/keys?keys=true # List all keys

But have not found any support. The closest I have found is this reference: \Basho\Riak\Api\Http::buildPath(): line 204: case 'Basho\Riak\Command\Bucket\Keys':

However, it doesn't appear that this class was actually implemented.

christophermancini commented 7 years ago

Hi @heylarson, at the time of initial redevelopment of the PHP client we decided that since the list keys operation is a very expensive operation for Riak and can be challenging to consume over HTTP (lack of pagination), that we did not implement it. Also, we have recently been focusing on addressing technical debt and improving Riak performance across the board which might lead to better list keys performance.

In the mean time, can I ask what your use case is? Maybe I can offer an alternate solution that will meet your needs without requiring additional changes to the client.

kodekraft commented 7 years ago

Hey Chris, Great to hear all the progress you're making on the library! The necessity for this functionality stems from a unit testing perspective. In between my integration unit tests, I like to clear any data from the previous test, which is where I found this function to be helpful. I agree with you in that this function could be expensive when used with larger data sets. For my workaround, I have used the guzzle library to interact with the http api to remove buckets and keys between unit tests, and works fine. Thank you for getting back to me. I'm open for other solutions of course.

christophermancini commented 7 years ago

@heylarson sorry for the delay. So, for this client, I handle cleanup of test data a few different ways.

If going a route that requires rebuilding bucket-types, the Ansible Riak role has support for creating them, making it pretty painless.

christophermancini commented 7 years ago

I am going to close this issue for now, if you need more help feel free to reopen this issue.