The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
NAME
    AnyEvent::Riak - AnyEvent ProtocolBuffers Riak Client

VERSION
    version 0.91

SYNOPSIS
      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();

ATTRIBUTES
  host => $hostname
    Str, Required. Riak IP or hostname. Default to 127.0.0.1

  port => $port_number
    Int, Required. Port of the PBC interface. Default to 8087

  on_connect => $cb->($handle, $host, $port, $retry->())
    CodeRef, required. Executed on connection. Check out
    AnyEvent::Handle#on_connect-cb--handle-host-port-retry

  on_connect_error => $cb->($handle, $message)
    CodeRef, required. Executed when the connection could not be
    established. Check out
    AnyEvent::Handle#on_connect_error-cb--handle-message

  connect_timeout => $fractional_seconds
    Float, Default 5. Timeout for connection operation, in seconds. Set to 0
    for no timeout.

  timeout => $fractional_seconds
    Float, Default 5. Timeout for read/write operation, in seconds. Set to 0
    for no timeout.

  no_delay => <boolean>
    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.

METHODS
  $client->close($cb)
    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.

DOCUMENTATION
    The exhaustive documentation is here:

    AnyEvent::Riak::Documentation

    However, the current module doesn't support all features documented.
    "get()" and "put()" works, the rest may work... The status of supported
    functions will be updated.

AUTHOR
    Damien Krotkine <dams@cpan.org>

COPYRIGHT AND LICENSE
    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.