GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::Riak::MapReduce(3) User Contributed Perl Documentation Net::Riak::MapReduce(3)

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

version 0.1702

    use Net::Riak;

    my $riak = Net::Riak->new( host => "http://10.0.0.127:8098/" );
    my $bucket = $riak->bucket("Cats");

    my $query = $riak->add("Cats");
    $query->map(
        'function(v, d, a) { return [v]; }',
        arg => [qw/some params to your function/]
    );

    $query->reduce("function(v) { return [v];}");
    my $json = $query->run(10000);

    # can also be used like:

    my $query = Net::Riak::MapReduce->new(
        client => $riak->client
    );

    # named functions
    my $json = $query->add_bucket('Dogs')
        ->map('Riak.mapValuesJson')
        ->reduce('Your.SortFunction')
        ->run;

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

phases
inputs_bucket
inputs
input_mode

arguments: Net::Riak::Bucket / Bucket name / Net::Riak::Object / Array

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.

Create a MapReduce job

    my $mapred = $riak->add( ["alice","p1"],["alice","p2"],["alice","p5"] );

Add your inputs to a MapReduce job

    $mapred->add( ["alice","p1"],["alice","p2"] );
    $mapred->add( "alice", "p5" );
    $mapred->add( $riak->bucket("alice")->get("p6") );

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

return: self

    ->map("function () {..}", keep => 0, args => ['foo', 'bar']);
    ->map('Riak.mapValuesJson'); # de-serializes data into JSON

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:

    language
    keep - flag
    arg - an arrayref of parameterss for the JavaScript function

arguments: $function, %options

return: $self

    ->reduce("function () {..}", keep => 1, args => ['foo', 'bar']);

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(...) ....')

arguments: $function, %options

arguments: $timeout

return: arrayref

Run the map/reduce operation and attempt to de-serialize the JSON response to a perl structure. rayref of RiakLink objects if the last phase is a link phase.

Timeout in milliseconds,

REST API

https://wiki.basho.com/display/RIAK/MapReduce

List of built-in named functions for map / reduce phases

http://hg.basho.com/riak/src/tip/doc/js-mapreduce.org#cl-496

franck cuny <franck@lumberjaph.net>, robin edwards <robin.ge@gmail.com>

This software is copyright (c) 2013 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.

2013-03-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.