}
# ABSTRACT: An interface to a Riak server.
use strict;
use warnings;
use Moose;
use JSON::XS qw/decode_json/;
use Data::Riak::Result;
use Data::Riak::ResultSet;
use Data::Riak::Bucket;
use Data:
} @parts
]
});
}
sub _buckets {
my $self = shift;
return decode_json(
$self->send_request({
method => 'GET',
uri => '/buckets',
Riak::Role::Bucket;
{
$Data::Riak::Role::Bucket::VERSION = '2.0';
}
use Moose::Role;
use JSON 'decode_json';
use Data::Riak::Link;
use Data::Riak::MapReduce;
use HTTP::Headers::ActionPack::LinkList
_;
my ($result) = $map_reduce_results->results->[0];
my ($count) = decode_json($result->value) || 0;
return $count->[0];
},
);
}
sub linkwalk {
my
index({
%{ $opts || {} },
retval_mangler => sub { [sort map { $_->[1] } @{ decode_json shift }] },
});
}
1;
__END__
=pod
=head1 NAME
Data::Riak::Role::Bucket
=head1 VERSION
pReduce::Phase::Link;
{
$Data::Riak::MapReduce::Phase::Link::VERSION = '1.1';
}
use Moose;
use JSON::XS ();
# ABSTRACT: Link phase of a MapReduce
with ('Data::Riak::MapReduce::Phase');
has buck
sub pack {
my $self = shift;
my $href = {};
$href->{keep} = $self->keep ? JSON::XS::true() : JSON::XS::false() if $self->has_keep;
$href->{bucket} = $self->bucket if $self->has_buck
ta::Riak::Async::Bucket;
{
$Data::Riak::Async::Bucket::VERSION = '2.0';
}
use Moose;
use JSON 'decode_json';
use namespace::autoclean;
with 'Data::Riak::Role::Bucket';
sub remove_all {
my ($s
Riak::MapReduce::Phase::Map::VERSION = '1.1';
}
use Moose;
use Moose::Util::TypeConstraints;
use JSON::XS ();
# ABSTRACT: Map phase of a MapReduce
with ('Data::Riak::MapReduce::Phase');
has langu
'
);
sub pack {
my $self = shift;
my $href = {};
$href->{keep} = $self->keep ? JSON::XS::true() : JSON::XS::false() if $self->has_keep;
$href->{language} = $self->language;
$href->{name}
esult::JSONValue;
{
$Data::Riak::Result::JSONValue::VERSION = '2.0';
}
# ABSTRACT: A result containing JSON data
use Moose::Role;
use JSON 'decode_json';
use namespace::autoclean;
sub json_value
{
my ($self) = @_;
decode_json $self->value;
}
1;
__END__
=pod
=head1 NAME
Data::Riak::Result::JSONValue - A result containing JSON data
=head1 VERSION
version 2.0
=head1 DESCRIPTION
Results for requests resulting in JSON data use this role to provide convenient
access to the decoded body payload.
=head1 METHODS
=head2 json_value
=head1 AUTHORS
=over 4
=item *
Andrew Nelson
ta::Riak::MapReduce::Phase::Reduce;
use HTTP::Headers::ActionPack::LinkList;
use JSON::XS qw/decode_json encode_json/;
with 'Data::Riak::Role::HasRiak';
has name => (
is => 'ro',
isa => '
ets/%s/keys', $self->name),
query => { keys => 'true' }
})->first;
return decode_json( $result->value )->{'keys'};
}
sub count {
my $self = shift;
my $map_reduce = Data::Ria
ce->mapreduce;
my ( $result ) = $map_reduce_results->results->[0];
my ( $count ) = decode_json($result->value) || 0;
return $count->[0];
}
sub remove_all {
my $self = shift;
my $
ta::Riak::Result::SingleJSONValue;
{
$Data::Riak::Result::SingleJSONValue::VERSION = '2.0';
}
# ABSTRACT: Single result containing JSON data
use Moose;
use JSON 'decode_json';
use namespace::autocl
Result::JSONValue',
'Data::Riak::Result::Single';
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Result::SingleJSONValue - Single result containing JSON data
=
his is a result class for requests returning a single result containing JSON
encoded data. It applies L<Data::Riak::Result::JSONValue> and
L<Data::Riak::Result::Single>.
=head1 AUTHORS
=over 4
=ite
s;
{
$Data::Riak::Request::Status::VERSION = '2.0';
}
use Moose;
use Data::Riak::Result::SingleJSONValue;
use Data::Riak::Exception::StatsNotEnabled;
use namespace::autoclean;
sub as_http_request_
return {
method => 'GET',
uri => 'stats',
accept => 'application/json',
};
}
sub _build_http_exception_classes {
return {
404 => Data::Riak::Exception
t::WithHTTPExceptionHandling';
has '+result_class' => (
default => Data::Riak::Result::SingleJSONValue::,
);
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Reque
$Data::Riak::Request::ListBuckets::VERSION = '2.0';
}
use Moose;
use Data::Riak::Result::SingleJSONValue;
use namespace::autoclean;
sub as_http_request_args {
my ($self) = @_;
return {
json',
};
}
sub _mangle_retval {
my ($self, $ret) = @_;
$ret->json_value->{buckets};
}
with 'Data::Riak::Request';
has '+result_class' => (
default => Data::Riak::Result::SingleJSON
Data::Riak::Request::ListBucketKeys::VERSION = '2.0';
}
use Moose;
use Data::Riak::Result::SingleJSONValue;
use namespace::autoclean;
sub as_http_request_args {
my ($self) = @_;
return {
=> 'application/json',
query => {
keys => 'true',
props => 'false',
},
};
}
sub _mangle_retval {
my ($self, $ret) = @_;
$ret->json_value->{keys};
a::Riak::Request::WithBucket';
has '+result_class' => (
default => Data::Riak::Result::SingleJSONValue::,
);
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Reque
$Data::Riak::Request::SetBucketProps::VERSION = '2.0';
}
use Moose;
use JSON 'encode_json';
use Data::Riak::Result::SingleJSONValue;
use namespace::autoclean;
has props => (
is => 'ro',
('buckets/%s/props', $self->bucket_name),
content_type => 'application/json',
data => encode_json $self->props,
};
}
with 'Data::Riak::Request::WithBucket';
has '+result_
:Object;
use Data::Riak::Exception::FunctionFailed;
use Data::Riak::Exception::Timeout;
use JSON 'encode_json';
use namespace::autoclean;
has data => (
is => 'ro',
isa => 'HashRef'
'POST',
uri => 'mapred',
content_type => 'application/json',
data => encode_json($self->data),
($self->chunked ? (query => { chunked => 'true' }) : ())
Data::Riak::Request::GetBucketProps::VERSION = '2.0';
}
use Moose;
use Data::Riak::Result::SingleJSONValue;
use namespace::autoclean;
sub as_http_request_args {
my ($self) = @_;
return {
/props', $self->bucket_name),
accept => 'application/json',
};
}
sub _mangle_retval {
my ($self, $ret) = @_;
$ret->json_value->{props};
}
with 'Data::Riak::Request::WithBucket';
has '+result_class' => (
default => Data::Riak::Result::SingleJSONValue::,
);
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Request::GetBucketProps
=head1 VERS
k;
use Data::Riak::MapReduce::Phase::Map;
use Data::Riak::MapReduce::Phase::Reduce;
use JSON::XS qw/encode_json/;
with 'Data::Riak::Role::HasRiak';
has inputs => (
is => 'ro',
isa => 'Arra
riak->send_request({
content_type => 'application/json',
method => 'POST',
uri => 'mapred',
data => encode_json({
inputs => $self->inputs,
query