Note, since writing this post, Riakc 1.0.0 has already been released and merged into opam. It fixes the below issue of Links (there is a typo in the release notes, 'not' should be 'now'. The source code can be found here. The 1.0.0 version number does not imply any stability or completeness of the library, just that it is not backwards compatible with 0.0.0.
Riakc is a Riak Protobuf client for Ocaml. Riakc uses Jane St Core/Async for concurrency. Riakc is in early development and so far supports a subset of the Riak API. The supported methods are:
- ping
- client_id
- server_info
- list_buckets
- list_keys
- bucket_props
- get
- put
- delete
A note on GET
Links are currently dropped all together in the implementation, so if you read a value with links and write it back, you will have lost them. This will be fixed in the very near future.
As with anything, please feel free to submit issues and pull requests.
The source code can be found here. Riakc is in opam and you can install it by doing opam install riakc
.
Usage
There are two API modules in Riakc. Examples of all existing API functions can be found here.
Riakc.Conn
Riakc.Conn
provides the API for performing actions on the database. The module interface can be read here.
Riakc.Robj
Riakc.Robj
provides the API for objects stored in Riak. The module interface can be read here. Riakc.Conn.get
returns a Riakc.Robj.t
and Riakc.Conn.put
takes one. Robj.t
supports representing siblings, however Riakc.Conn.put
cannot PUT objects with siblings, this is enforced using phantom types. A value of Riakc.Robj.t
that might have siblings is converted to one that doesn't using Riakc.Robj.set_content
.