diff options
author | Gavin Carr <gavin@openfusion.com.au> | 2010-09-07 20:56:47 +0100 |
---|---|---|
committer | Gavin Carr <gavin@openfusion.com.au> | 2010-09-07 20:56:47 +0100 |
commit | f977241edf43e900d8776c16f80cbaf4858f2b91 (patch) | |
tree | bba6b2d42bd2d0f06b9b0945c476072e007e3be1 /lib | |
parent | increase LWP MaxLineLength to allow long riak Link http headers (diff) | |
download | net-riak-f977241edf43e900d8776c16f80cbaf4858f2b91.tar.gz |
add keys => 'stream' support to get_properties
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Net/Riak/Bucket.pm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Net/Riak/Bucket.pm b/lib/Net/Riak/Bucket.pm index cd42316..9c246d5 100644 --- a/lib/Net/Riak/Bucket.pm +++ b/lib/Net/Riak/Bucket.pm @@ -89,7 +89,18 @@ sub get_properties { die "Error getting bucket properties: " . $response->status_line . "\n"; } - return JSON::decode_json($response->content); + if ($params->{keys} ne 'stream') { + return JSON::decode_json($response->content); + } + + # In streaming mode, aggregate keys from the multiple returned chunk objects + else { + my $json = JSON->new; + my $props = $json->incr_parse($response->content); + my @keys = map { $_->{keys} && ref $_->{keys} eq 'ARRAY' ? @{$_->{keys}} : () } + $json->incr_parse; + return { props => $props, keys => \@keys }; + } } sub set_properties { |