Net::Riak::MapReduce - Allows you to build up and run a map/reduce operation on Riak
version 0.09
my $riak = Net::Riak->new( host => "http://10.0.0.127:8098/" ); my $bucket = $riak->bucket("mybucket"); my $mapred = $riak->add("mybucket"); $mapred->map('function(v) { return [v]; }'); $mapred->reduce("function(v) { return v;}"); my $res = $mapred->run(10000);
The RiakMapReduce object allows you to build up and run a map/reduce operation on Riak.
arguments: bucketname
return: a Net::Riak::MapReduce object
Add inputs to a map/reduce operation. This method takes three different forms, depending on the provided inputs. You can specify either a RiakObject, a string bucket name, or a bucket, key, and additional arg.
arguments: bucketname, tag, keep
return: self
Add a link phase to the map/reduce operation.
The default value for bucket name is '_', which means all buckets.
The default value for tag is '_'.
The flag argument means to flag whether to keep results from this stage in the map/reduce. (default False, unless this is the last step in the phase)
arguments: function, options
Add a map phase to the map/reduce operation.
functions is either a named javascript function (i: 'Riak.mapValues'), or an anonymous javascript function (ie: 'function(...) ....')
options is an optional associative array containing 'languaga', 'keep' flag, and/or 'arg'
Add a reduce phase to the map/reduce operation.
arguments: timeout
return: array
Run the map/reduce operation. Returns an array of results, or an array of RiakLink objects if the last phase is a link phase.
Timeout in milliseconds.
franck cuny <franck@lumberjaph.net>
This software is copyright (c) 2010 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.
To install Net::Riak, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Riak
CPAN shell
perl -MCPAN -e shell install Net::Riak
For more information on module installation, please visit the detailed CPAN module installation guide.