def stream_keys(self, bucket): """ Streams keys from a bucket, returning an iterator that yields lists of keys. """ req = riak_pb.RpbListKeysReq() req.bucket = bucket.name self._send_msg(MSG_CODE_LIST_KEYS_REQ, req) return RiakPbcKeyStream(self)
def stream_keys(self, bucket, timeout=None): """ Streams keys from a bucket, returning an iterator that yields lists of keys. """ req = riak_pb.RpbListKeysReq() req.bucket = bucket.name if self.client_timeouts() and timeout: req.timeout = timeout self._send_msg(MSG_CODE_LIST_KEYS_REQ, req) return RiakPbcKeyStream(self)
async def get_keys(self, bucket): ''' Lists all keys within a bucket. ''' req = riak_pb.RpbListKeysReq() req.bucket = bucket.name.encode() keys = [] self._add_bucket_type(req, bucket.bucket_type) for code, res in await self._stream(messages.MSG_CODE_LIST_KEYS_REQ, req, messages.MSG_CODE_LIST_KEYS_RESP): for key in res.keys: keys.append(key.decode()) return keys
def get_keys(self, bucket): """ Lists all keys within a bucket. """ req = riak_pb.RpbListKeysReq() req.bucket = bucket.get_name() keys = [] def _handle_response(resp): for key in resp.keys: keys.append(key) self.send_msg_multi(MSG_CODE_LIST_KEYS_REQ, req, MSG_CODE_LIST_KEYS_RESP, _handle_response) return keys