Group
Extension

Matches 13

Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/MapReduce.pm ( view source; MetaCPAN )
ION = '0.1702';
}

# ABSTRACT: Allows you to build up and run a map/reduce operation on Riak

use JSON;
use Moose;
use Scalar::Util;

use Data::Dumper;

use Net::Riak::LinkPhase;
use Net::Riak::MapRed
 my ($self, $bucket, $tag, $keep) = @_;
    $bucket ||= '_';
    $tag    ||= '_';
    $keep   ||= JSON::false;

    $self->add_phase(
        Net::Riak::LinkPhase->new(
            bucket => $bucket,
     type     => 'map',
        function => $function,
        keep     => $options{keep} ? JSON::true : JSON::false,
        arg      => $options{arg} || [],
    );
    $self->add_phase($map_reduce);
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/PBC/Object.pm ( view source; MetaCPAN )
ackage Net::Riak::Role::PBC::Object;
{
  $Net::Riak::Role::PBC::Object::VERSION = '0.1702';
}
use JSON;
use Moose::Role;
use List::Util 'first';

sub store_object {
    my ($self, $w, $dw, $object) = 
ey;

    my $value = (ref $object->data && $object->content_type eq 'application/json')
            ? JSON::encode_json($object->data) : $object->data;

    my $content = {
        content_type => $ob
 $content->usermeta);
    }

    my $data = ($object->content_type eq 'application/json')
        ? JSON::decode_json($content->value) : $content->value;

    $object->exists(1);

    $object->data($d
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Object.pm ( view source; MetaCPAN )
 content_type => (is => 'rw', isa => 'Str', default => 'application/json');
has location     => (is => 'rw', isa => 'Str');
has _jsonize     => (is => 'rw', isa => 'Bool', lazy => 1, default => 1);
ha
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/LinkPhase.pm ( view source; MetaCPAN )
;
}

use Moose;
use JSON;

has bucket => (is => 'ro', isa => 'Str', required => 1);
has tag    => (is => 'ro', isa => 'Str', required => 1);
has keep   => (is => 'rw', isa => 'JSON::Boolean', required
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/MapReducePhase.pm ( view source; MetaCPAN )
ucePhase;
{
  $Net::Riak::MapReducePhase::VERSION = '0.1702';
}

use Moose;
use Scalar::Util;
use JSON;

has type     => (is => 'rw', isa => 'Str',      required => 1,);
has function => (is => 'ro', i
', isa => 'Str',      default  => 'javascript');
has keep => (is => 'rw', isa => 'JSON::Boolean', default => sub {JSON::false});

sub to_array {
    my $self = shift;

    my $step_def = {
        kee
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Search.pm ( view source; MetaCPAN )
>setup_indexing('bucket_name');

Does the same as :

    curl -X PUT -H "content-type:application/json" http://localhost:8098/riak/bucket_name -d '{"props":{"precommit":[{"mod":"riak_search_kv_hook","
earch(
        q => 'bucket_name.field:value'
    );

Search the index

=over 4

=item wt => 'XML|JSON'

defines the response format (XML is the default value as for Solr/Lucene)

=item q

the query s
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/REST.pm ( view source; MetaCPAN )
buckets.. are you running riak 0.14+?"
        unless $response->is_success;
    my $resp = JSON::decode_json($response->content);
    return ref ($resp->{buckets}) eq 'ARRAY' ? @{$resp->{buckets}} : 
new_request('GET', ["stats"]);
    my $response = $self->send_request($request);
    return JSON::decode_json($response->content);
}

1;

__END__

=pod

=head1 NAME

Net::Riak::Role::REST - role for R
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/REST/MapReduce.pm ( view source; MetaCPAN )
EST::MapReduce;
{
  $Net::Riak::Role::REST::MapReduce::VERSION = '0.1702';
}
use Moose::Role;
use JSON;
use Data::Dumper;

sub execute_job {
    my ($self, $job, $timeout) = @_;

    # save existing t
int($timeout/1000));
        }
        $job->{timeout} = $timeout;
    }

    my $content = JSON::encode_json($job);

    my $request = $self->new_request(
        'POST', [$self->mapred_prefix]
    )
success) {
        die "MapReduce query failed: ".$response->status_line;
    }

    return JSON::decode_json($response->content);
}

1;

__END__

=pod

=head1 NAME

Net::Riak::Role::REST::MapReduce

Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/PBC/MapReduce.pm ( view source; MetaCPAN )
e::Role;
use JSON;
use List::Util 'sum';

sub execute_job {
    my ($self, $job, $timeout, $returned_phases) = @_;

    $job->{timeout} = $timeout;

    my $job_request = JSON::encode_json($job);

   
age( MapRedReq => {
            request => $job_request,
            content_type => 'application/json'
        }, sub { push @$results, $self->decode_phase(shift) })
        or
    die "MapReduce que
 $resp) = @_;

    if (defined $resp->response && length($resp->response)) {
        return JSON::decode_json($resp->response);
    }

    return;
}

1;

__END__

=pod

=head1 NAME

Net::Riak::Role::P
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/REST/Search.pm ( view source; MetaCPAN )
ole::REST::Search;
{
  $Net::Riak::Role::REST::Search::VERSION = '0.1702';
}
use Moose::Role;
use JSON;

#ABSTRACT: Search interface

sub search {
    my $self = shift;
    my %params = @_;
    my $re
>code;
    if ($status == 404) {
        return;
    }

    return JSON::decode_json($http_response->content) if $params{wt} =~ /json/i;
    $http_response->content;
};

sub setup_indexing {
    my ( 
   return;
    }

    my $precommits = JSON::decode_json($http_response->content)->{props}->{precommit};

    for (@$precommits){
        return JSON::decode_json($http_response->content) if $_->{mod}
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/REST/Object.pm ( view source; MetaCPAN )
le::REST::Object;
{
  $Net::Riak::Role::REST::Object::VERSION = '0.1702';
}

use Moose::Role;
use JSON;

sub store_object {
    my ($self, $w, $dw, $object) = @_;

    my $params = {returnbody => 'tru
    }

    if (ref $object->data && $object->content_type eq 'application/json') {
        $request->content(JSON::encode_json($object->data));
    }
    else {
        $request->content($object->data
      if $http_response->content_type;
        $obj->data(JSON::decode_json($obj->data))
            if $obj->content_type eq 'application/json';
        $obj->vclock($http_response->header('X-Riak-Vc
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Role/REST/Bucket.pm ( view source; MetaCPAN )
le::REST::Bucket;
{
  $Net::Riak::Role::REST::Bucket::VERSION = '0.1702';
}

use Moose::Role;
use JSON;

sub get_properties {
    my ($self, $name, $params) = @_;

    # Callbacks require stream mode
urn JSON::decode_json($response->content);
    }

    # In streaming mode, aggregate keys from the multiple returned chunk objects
    else {
        my $json = JSON->new;
        my $props = $json->i
ncr_parse($response->content);
        if ($params->{cb}) {
            while (defined(my $obj = $json->incr_parse)) {
                $params->{cb}->($_) foreach @{$obj->{keys}};
            }
      
Net-Riak ( R/RG/RGE/Net-Riak-0.1702.tar.gz, RGE, 2013; MetaCPAN )
Net-Riak/lib/Net/Riak/Bucket.pm ( view source; MetaCPAN )
1
);
has content_type => (
    is      => 'rw',
    isa     => 'Str',
    default => 'application/json'
);

sub n_val {
    my $self = shift;
    if (my $val = shift) {
        $self->set_property('n_
 and no explicit Object content_type is given in @args, the data will be serialised and stored as JSON.

If $key is passed as C<undef> then an autogenerated key will be provided by Riak.

=item get

 

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.