AnyEvent::Riak - AnyEvent ProtocolBuffers Riak Client
version 0.93
use AnyEvent::Riak; my $cv1 = AE::cv; my $client = AnyEvent::Riak->new( on_connect => sub { $cv1->send }, on_connect_error => sub { $cv1->croak($_[1])}, ); $cv1->recv; my $cv2 $client->put({ bucket => 'bucket_name', key => 'key_name', content => { value => 'plip', content_type => 'text/plain', }, }, sub { my ($result, $error) = @_; $error and $cv2->croak( sprintf("error %d: %s", @{$error}{qw(error_code error_message)}) ); $cv2->send($result); }); my $put_result = $cv2->recv(); my $cv3 = AE::cv; $client->get({ bucket => 'bucket_name', key => 'key_name', }, sub { my ($result, $error) = @_; $error and $cv3->croak( sprintf("error %d: %s", @{$error}{qw(error_code error_message)}) ); $cv3->send($result); }); my $get_result = $cv3->recv();
Str, Required. Riak IP or hostname. Default to 127.0.0.1
Int, Required. Port of the PBC interface. Default to 8087
CodeRef, required. Executed on connection. Check out AnyEvent::Handle#on_connect-cb--handle-host-port-retry
CodeRef, required. Executed when the connection could not be established. Check out AnyEvent::Handle#on_connect_error-cb--handle-message
Float, Default 5. Timeout for connection operation, in seconds. Set to 0 for no timeout.
Float, Default 5. Timeout for read/write operation, in seconds. Set to 0 for no timeout.
Boolean, Default 0. If set to a true value, TCP_NODELAY will be enabled on the socket, which means deactivating Nagle's algorithm. Use only if you know what you're doing.
This method will wait until everything has been written to the connection, then close the connection, and then calls the callback without parameters. Use this to properly close the connection, before destroying the client instance.
Get bucket properties request.
required, string
optional, string
Set bucket properties request
required, RpbBucketProps
Reset bucket properties request
Get bucket properties request
Get Request - retrieve bucket/key
optional, number
optional, boolean
fail if the supplied vclock does not match
return everything but the value
return the tombstone's vclock, if applicable
Experimental, may change/disappear
Bucket type, if not set we assume the 'default' type
Put request - if options.return_body is set then the updated metadata/data for the key will be returned.
required, RpbContent
Results returned from various methods are blessed response objects from the following types. Their attributes can be accessed using accessors (of the same name), or using the response as a HashRef.
Error response - may be generated for any Req
required, number
Get server info request - no message defined, just send RpbGetServerInfoReq message code
Get bucket properties response
Get ClientId Request - no message defined, just send RpbGetClientIdReq message code
Client id in use for this connection
Get Response - if the record was not found there will be no content/vclock
repeated, RpbContent
the opaque vector clock for the object
Put response - same as get response with optional key if one was generated
the key generated, if any
List buckets response - one or more of these packets will be sent the last one will have done set true (and may not have any buckets in it)
repeated, string
List keys in bucket response - one or more of these packets will be sent the last one will have done set true (and may not have any keys in it)
Map/Reduce response one or more of these packets will be sent the last one will have done set true (and may not have phase/data in it)
Secondary Index query response
repeated, RpbPair
return for CS bucket fold
repeated, RpbIndexObject
Counter update response? No message | error response
optional, sint64
Counter value response
Damien Krotkine <dams@cpan.org>
This software is copyright (c) 2014 by Damien Krotkine.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install AnyEvent::Riak, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Riak
CPAN shell
perl -MCPAN -e shell install AnyEvent::Riak
For more information on module installation, please visit the detailed CPAN module installation guide.