NAME

Net::Riak::Object - holds meta information about a Riak object

VERSION

version 0.1702

SYNOPSIS

my $obj = $bucket->get('foo');

DESCRIPTION

The Net::Riak::Object holds meta information about a Riak object, plus the object's data.

ATTRIBUTES

key
my $key = $obj->key;

Get the key of this object

client
bucket
data

Get or set the data stored in this object.

r
w
dw
content_type

Get an array of Net::Riak::Link objects

exists

Return true if the object exists, false otherwise.

siblings

Return an array of Siblings

METHODS

Return the number of links

Return the number of links

Add a new link

get_siblings

Return the number of siblings

add_sibling

Add a new sibling

count_siblings
get_sibling

Return a sibling

all_meta

Returns a hash containing all the meta name/value pairs

my %metadata = $obj->all_meta;
has_meta

Returns the number of usermetas associated with the object. Typical use is as a predicate method.

if ( $obj->has_meta ) { ... }
set_meta

Sets a usermeta on the object, overriding any existing value for that key

$obj->set_meta( key => $value );
get_meta

Reads a single usermeta from the object. If multiple usermeta headers have been set for a single key (eg via another client), the values will be separated with a comma; Riak will concatenate the input headers and only return a single one.

remove_meta

removes a single usermeta from the object. Returns false on failure, eg if the key did not exist on the object.

$obj->remove_meta( 'key' ) || die( "could not remove" );
store
$obj->store($w, $dw);

Store the object in Riak. When this operation completes, the object could contain new metadata and possibly new data if Riak contains a newer version of the object according to the object's vector clock.

w

W-value, wait for this many partitions to respond before returning to client.

dw

DW-value, wait for this many partitions to confirm the write before returning to client.

load
$obj->load($w);

Reload the object from Riak. When this operation completes, the object could contain new metadata and a new value, if the object was updated in Riak since it was last retrieved.

r

R-Value, wait for this many partitions to respond before returning to client.

delete
$obj->delete($dw);

Delete this object from Riak.

dw

DW-value. Wait until this many partitions have deleted the object before responding.

clear
$obj->reset;

Reset this object

has_siblings
if ($obj->has_siblings) { ... }

Return true if this object has siblings

has_no_siblings
if ($obj->has_no_siblings) { ... }

Return true if this object has no siblings

populate_object

Given the output of RiakUtils.http_request and a list of statuses, populate the object. Only for use by the Riak client library.

$obj->add_link($obj2, "tag");

Add a link to a Net::Riak::Object

$obj->remove_link($obj2, "tag");

Remove a link to a Net::Riak::Object

add

Start assembling a Map/Reduce operation

Start assembling a Map/Reduce operation

map

Start assembling a Map/Reduce operation

reduce

Start assembling a Map/Reduce operation

AUTHOR

franck cuny <franck@lumberjaph.net>, robin edwards <robin.ge@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by linkfluence.

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