Struct riak::Client [] [src]

pub struct Client { /* fields omitted */ }

Client Represents a connection to a Riak server's Protocol Buffers API.

For more information: https://docs.basho.com/riak/kv/latest/developing/api/protocol-buffers/

Methods

impl Client
[src]

Constructs a new Client.

Examples

use riak::Client;

let mut riak = Client::new("10.0.0.2:8087").unwrap();
riak.ping().unwrap();

Errors

TODO

Reconnect to the Riak server originally connected to when this client was initiated.

Examples

use riak::Client;

let mut riak = Client::new("10.0.0.2:8087").unwrap();
riak.reconnect().unwrap();

Errors

TODO

Sends a ping message to Riak and returns a Result.

Examples

use riak::Client;

let mut riak = Client::new("10.0.0.2:8087").unwrap();
riak.ping().unwrap();

Errors

TODO

Produces a list of bucket names.

Note: This operation is expensive for the Riak server and should be used as rarely as possible.

Examples

use riak::Client;

let mut riak = Client::new("10.0.0.2:8087").unwrap();
let buckets = riak.list_buckets().unwrap();

for bucket in buckets.iter() {
    println!("found bucket named {}", bucket);
}

Errors

TODO

Sets the properties for a bucket given a bucket name.

Examples

use riak::Client;
use riak::bucket::BucketProps;

let mut riak = Client::new("10.0.0.2:8087").unwrap();
let mut bucket_props = BucketProps::new();
bucket_props.set_backend("bitcask");

riak.set_bucket_properties("superheroes", &bucket_props).unwrap();

Errors

TODO

Retrieves bucket properties for a bucket given a bucket name.

Examples

use riak::Client;

let mut riak = Client::new("10.0.0.2:8087").unwrap();
let bucket_props = riak.get_bucket_properties("superheroes").unwrap();
println!("bucket properties for superheroes: {:?}", bucket_props);

Errors

TODO

Stores an object on the Riak server.

Examples

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

let mut riak = Client::new("10.0.0.2:8087").unwrap();

let contents = ObjectContent::new("I am the night, I am Batman!".as_bytes());
let mut req = StoreObjectReq::new("superheroes", &contents);
req.set_key("batman");

riak.store_object(&req).unwrap();

Errors

TODO

Fetches an object from the Riak server.

Examples

use riak::Client;
use riak::object::FetchObjectReq;

let mut riak = Client::new("10.0.0.2:8087").unwrap();

let req = FetchObjectReq::new("superheroes", "batman");
let object = riak.fetch_object(&req).unwrap();
println!("batman object contained: {:?}", object);

Errors

TODO

Trait Implementations

impl Debug for Client
[src]

Formats the value using the given formatter.