ANN: Riak C Client *alpha*

Dave Parfitt dparfitt at
Wed Oct 30 13:58:41 EDT 2013

Hello -

  We would like to take a moment to announce an ***alpha*** version of the
official Basho Riak C Client [0]. Under the hood, the new C client has a
protobuffs only interface and uses libevent [1] for both synchronous and
asynchronous communications with Riak. Basho is planning on the addition of
Yokozuna and CRDT support to complement the future Riak 2.0 release, but we
still have to finish up 1.4 message implementation (such as M/R & 2i). Our
goal is to make this client rock-solid and threads-safe, as it can possibly
be used as the basis for C++, PHP and other clients.

As an *alpha* release, expect things to be broken, changes to the API, and
untested features. DO *NOT* USE THIS IN PRODUCTION.

Currently, the client supports many of the Riak 1.4.x messages:

- get
- put
- delete
- ping
- server info
- list buckets
- list keys
- get/set client id
- get/set/reset bucket properties

Here's what it looks like:

riak_context *ctx;
riak_object *obj;

riak_error err = riak_context_new_default(&ctx);
err = riak_context_add_default_connection(ctx, riakhost, riakpbport);
err = riak_context_add_logging(ctx, NULL);

obj = riak_object_new(ctx);
if (obj == NULL) {
    riak_log_fatal(rev, "%s","Could not allocate a Riak Object");
    return 1;

// the binaries created below need to be freed eventually
// however, this is just a sample
riak_object_set_bucket(obj, riak_binary_new_from_string(ctx, "mybucket"));
riak_object_set_key(obj, riak_binary_new_from_string(ctx, "mykey"));
riak_object_set_value(obj, riak_binary_new_from_string(ctx, "myvalue"));

// setup put options
riak_put_options *put_options = riak_put_options_new(ctx);
riak_put_options_set_return_head(put_options, RIAK_FALSE);
riak_put_options_set_return_body(put_options, RIAK_FALSE);

// perform the PUT
riak_put_response *put_response;
err = riak_put(ctx, obj, put_options, &put_response);
// check the response and print it
if (err != ERIAK_OK) {
    riak_print_put_response(put_response, output, sizeof(output));
    printf("%s\n", output);

// clean up
riak_free_put_response(ctx, &put_response);
riak_object_free(ctx, &obj);


We're sending this announcement out now because a) we're excited to get this
project up and running, and b) we would like your feedback, testing, pull
requests, and/or rotten tomatoes. If you would like to contribue or submit
a bug report, please check the issues list first [2].

Cheers -
Brett [3] and Dave [4]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list