-
-
15 Mar 2012 16:16:01 UTC
- Distribution: Net-Riak
- Module version: 0.1600
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (98 / 427 / 0)
- Kwalitee
Bus factor: 0- License: perl_5
- Activity
24 month- Tools
- Download (36.22KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
++ed by:1 non-PAUSE userand 1 contributors-
franck cuny, robin edwards <robin.ge@gmail.com>
- Dependencies
- Data::Dump
- Data::Dumper
- Exporter
- Google::ProtocolBuffers
- IO::Socket::INET
- JSON
- LWP::ConnCache
- LWP::UserAgent
- List::Util
- MIME::Base64
- Moose
- Moose::Role
- MooseX::Role::Parameterized
- MooseX::Traits
- MooseX::Types
- MooseX::Types::Moose
- MooseX::Types::Structured
- Scalar::Util
- URI
- base
- bytes
- strict
- warnings
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Net::Riak - Interface to Riak
VERSION
version 0.1600
SYNOPSIS
# REST interface my $client = Net::Riak->new( host => 'http://10.0.0.40:8098', ua_timeout => 900, ); # Or PBC interface. my $client = Net::Riak->new( transport => 'PBC', host => '10.0.0.40', port => 8080 ); 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}; # Indexing and searching (REST interface) $client->setup_indexing("bucket_name"); ...adding documents to riak... my $response = $client->search( index => 'bucket_name', q => 'field:value' );
DESCRIPTION
ATTRIBUTES
- host
-
REST: The URL of the node
PBC: The hostname of the node
default 'http://127.0.0.1:8098'
Note that providing multiple hosts is now deprecated.
- port
-
Port of the PBC interface.
- transport
-
Used to select the PB protocol by passing in 'PBC'
- 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 (REST only)
-
timeout for LWP::UserAgent in seconds, defaults to 3.
- disable_return_body (REST only)
-
Disable returning of object content in response in a store operation.
If set to true and the object has siblings these will not be available without an additional fetch.
This will become the default behaviour in 0.17
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
all_buckets
List all buckets, requires Riak 0.14+ or PBC connection.
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
server_info (PBC only)
$client->server_info->{server_version};
stats (REST only)
say Dumper $client->stats;
search (REST only)
$client->search( index => 'bucket_name', q => 'field:value' );
Makes a query to the index (see Net::Riak::Search for more details on parameters)
setup_indexing (REST only)
$client->setup_indexing('bucket_name');
Define precommit hook in order to enable indexing documents written into the given bucket
SEE ALSO
AUTHOR
franck cuny <franck@lumberjaph.net>, robin edwards <robin.ge@gmail.com>
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.
Module Install Instructions
To install Net::Riak, copy and paste the appropriate command in to your terminal.
cpanm Net::Riak
perl -MCPAN -e shell install Net::Riak
For more information on module installation, please visit the detailed CPAN module installation guide.