A versatile C11 client library for Riak KV.
Project details
libriak-c is a C11 client library designed for seamless interaction with Riak KV, supporting both Protocol Buffers and HTTP. It enables efficient data operations like querying, object management, and secondary indexing while providing features like failover support and asynchronous I/O, ensuring robust performance and reliability.
libriak-c is a C11 client library designed for interacting with Riak KV using both Protocol Buffers and HTTP interfaces. Built upon technologies such as protobuf-c, OpenSSL, libcurl, and json-c, this library provides a robust and efficient solution for managing key-value data.
Integrating libriak-c into a project can be accomplished with minimal code:
#include <stdio.h>
#include <riak/riak.h>
int main(void) {
riak_global_init();
riak_config cfg;
riak_config_init(&cfg); // Protocol Buffers, 127.0.0.1:8087
riak_client *c;
if (riak_client_new(&cfg, &c) != RIAK_OK)
return 1;
riak_opts o = {.content_type = "text/plain"};
riak_put(c, "greetings", "hello", "world", 5, &o, NULL, NULL);
riak_object obj;
riak_status st = riak_get(c, "greetings", "hello", NULL, &obj);
if (st == RIAK_OK) {
printf("%.*s\n", (int)obj.len, obj.data);
riak_object_free(&obj);
} else {
fprintf(stderr, "%s: %s\n", riak_strerror(st), riak_client_errmsg(c));
}
riak_client_free(c);
riak_global_cleanup();
return 0;
}
The library can be linked using pkg-config or integrated with CMake for streamlined development.
Comprehensive guides and documentation are available in the docs/ directory, covering all aspects from getting started to detailed operation instructions, security guidelines, and testing. API references can be generated using Doxygen to aid in development and usage.
For contributions or reporting issues, guidelines are provided in CONTRIBUTING.md and SECURITY.md. This library stands as a powerful tool for developers working with Riak KV, offering versatile functionalities and robust performance.
Comments
0Start the conversation
Share the first comment.