NAME
Net::Riak - Interface to Riak
VERSION
version 0.14
SYNOPSIS
my $client = Net::Riak->new(
host => '
http://10.0.0.40:8098',
ua_timeout => 900
);
my $bucket = $client->bucket('blog');
my $obj = $bucket->new_object('new_post', {title => 'foo', content => 'bar'});
$obj->store;
$obj = $bucket->get('new_post');
say "title for ".$obj->key." is ".$obj->data->{title};
my $req = $client->http_request; # last request
$client->http_response # last response
DESCRIPTION
ATTRIBUTES
host
URL of the node (default '
http://127.0.0.1:8098'). If your ring is
composed with more than one node, you can configure the client to
hit more than one host, instead of hitting always the same node. For
this, you can do one of the following:
all nodes equals
my $riak = Net::Riak->new(
host => [
'
http://10.0.0.40:8098',
'
http://10.0.0.41:8098'
]
);
give weight to nodes
my $riak = Net::Riak->new(
host => [
{node => '
http://10.0.0.40:8098', weight => '0.2'},
{node => '
http://10.0.0.41:8098', weight => '0.8'}
]
);
Now, when a request is made, a node is picked at random, according
to weight.
prefix
Interface prefix (default 'riak')
mapred_prefix
MapReduce prefix (default 'mapred')
r R value setting for this client (default 2)
w W value setting for this client (default 2)
dw DW value setting for this client (default 2)
client_id
client_id for this client
ua_timeout
timeout for LWP::UserAgent in seconds, defaults to 3.
METHODS
http_request
Returns the HTTP::Request object from the last request
http_response
Returns a HTTP::Response object from the last request
METHODS
bucket
my $bucket = $client->bucket($name);
Get the bucket by the specified name. Since buckets always exist, this
will always return a Net::Riak::Bucket
is_alive
if (!$client->is_alive) {
...
}
Check if the Riak server for this client is alive
add
my $map_reduce = $client->add('bucket_name', 'key');
Start assembling a Map/Reduce operation
link
my $map_reduce = $client->link();
Start assembling a Map/Reduce operation
map
my $map_reduce = $client->add('bucket_name', 'key')->map("function ...");
Start assembling a Map/Reduce operation
reduce
my $map_reduce = $client->add(..)->map(..)->reduce("function ...");
Start assembling a Map/Reduce operation
SEE ALSO
Net::Riak::MapReduce
AUTHOR
franck cuny <
[email protected]>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by linkfluence.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
POD ERRORS
Hey! The above document had some coding errors, which are explained
below:
Around line 126:
'=item' outside of any '=over'
Around line 130:
You forgot a '=back' before '=head1'