The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Riak::MapReduce - Allows you to build up and run a map/reduce operation on Riak

VERSION

version 0.09

SYNOPSIS

    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);

DESCRIPTION

The RiakMapReduce object allows you to build up and run a map/reduce operation on Riak.

ATTRIBUTES

phases
inputs_bucket
inputs
input_mode

METHODS

add

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.

add_object
add_bucket_key_data
add_bucket

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)

map

arguments: function, options

return: self

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'

reduce

arguments: function, options

return: self

Add a reduce 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'

run

arguments: function, options

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.

AUTHOR

franck cuny <franck@lumberjaph.net>

COPYRIGHT AND LICENSE

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.