riak 0.2.5

A Riak client for Rust.
Documentation

riak-rust-client

Build Status crates.io License Docs

A Riak client for Rust.

Description

This client allows you to connect to the Protocol Buffers API of a Riak Node and use the functionality provided to send data, retrieve data, and otherwise communicate with Riak.

This client communicates directly with the Protocol Buffer API on a specified Riak node, and does not provide any abstractions around a cluster of nodes (something TODO in a different crate later).

Requirements

This client is tested against Rust's stable, beta, and nightly branches. It should work with any modern Rust.

You'll of course have to provide your own Riak nodes. If you don't already have some check this documentation to get you started using Riak.

Usage

For complete documentation of what you can do with this client, see the rustdoc documentation available on docs.rs.

Examples

Storing an object:

use riak::Client;
use riak::object::{ObjectContent, StoreObjectReq};

// connect to Riak and ping the server
let mut riak = Client::new("10.0.0.2:8087").unwrap();
riak.ping().unwrap();

// prepare an object
let contents = ObjectContent::new("This is a test!".as_bytes());

// build a request to store the object
let mut req = StoreObjectReq::new("testbucket", &contents);
req.set_key("testkey");

// store the object
riak.store_object(&req).unwrap();