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 - Non-blocking Riak client

SYNOPSIS

  use AnyEvent::Riak;

  my $riak = AnyEvent::Riak->new(
    host => 'http://127.0.0.1:8098',
    path => 'jiak',
  );

  my $buckets    = $riak->list_bucket('bucketname')->recv;
  my $new_bucket = $riak->set_bucket('foo', {allowed_fields => '*'})->recv;
  my $store      = $riak->store({bucket => 'foo', key => 'bar', object => {baz => 1},link => []})->recv;
  my $fetch      = $riak->fetch('foo', 'bar')->recv;
  my $delete     = $riak->delete('foo', 'bar')->recv;

DESCRIPTION

AnyEvent::Riak is a non-blocking riak client using anyevent.

METHODS

list_bucket

Get the schema and key list for 'bucket'

    $riak->list_bucket('bucketname')->recv;
set_bucket

Set the schema for 'bucket'. The schema parameter must be a hash with at least an 'allowed_fields' field. Other valid fields are 'requried_fields', 'read_mask', and 'write_mask'.

    $riak->new_bucket('bucketname', {allowed_fields => '*'})->recv;
fetch

Get the object stored in 'bucket' at 'key'.

    $riak->fetch('bucketname', 'key')->recv;
store

Store 'object' in Riak. If the object has not defined its 'key' field, a key will be chosen for it by the server.

    $riak->store({
        bucket => 'bucketname', 
        key    => 'key', 
        object => { foo => "bar", baz => 2 },
        links  => [],
    })->recv;
delete

Delete the data stored in 'bucket' at 'key'.

    $riak->delete('bucketname', 'key')->recv;
walk

Follow links from the object stored in 'bucket' at 'key' to other objects. The 'spec' parameter should be an array of hashes, each hash optinally defining 'bucket', 'tag', and 'acc' fields. If a field is not defined in a spec hash, the wildcard '_' will be used instead.

    ok $res = $jiak->walk( 
        'bucketname', 
        'key', 
        [ { bucket => 'bucketname', key => '_' } ] 
    )->recv;

AUTHOR

franck cuny <franck@lumberjaph.net>

SEE ALSO

LICENSE

Copyright 2009 by linkfluence.

http://linkfluence.net

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.