Public Member Functions

RiakObject Class Reference

Public Member Functions

 RiakObject ($client, $bucket, $key=NULL)
 getBucket ()
 getKey ()
 getData ()
 setData ($data)
 status ()
 exists ()
 getContentType ()
 setContentType ($content_type)
 addLink ($obj, $tag=NULL)
 removeLink ($obj, $tag=NULL)
 getLinks ()
 store ($w=NULL, $dw=NULL)
 reload ($r=NULL)
 delete ($dw=NULL)
 populate ($response, $expected_statuses)
 hasSiblings ()
 getSiblingCount ()
 getSibling ($i, $r=NULL)
 getSiblings ($r=NULL)
 add ($params)
 link ($params)
 map ($params)
 reduce ($params)

Member Function Documentation

add ( params )

Start assembling a Map/Reduce operation.

See also:
RiakMapReduce::add()
Returns:
RiakMapReduce
addLink ( obj,
tag = NULL 
)

Add a link to a RiakObject.

Parameters:
mixed$obj- Either a RiakObject or a RiakLink object.
string$tag- Optional link tag. (default is bucket name, ignored if $obj is a RiakLink object.)
Returns:
RiakObject
delete ( dw = NULL )

Delete this object from Riak.

Parameters:
integer$dw- DW-value. Wait until this many partitions have deleted the object before responding.
Returns:
$this
exists (  )

Return true if the object exists, false otherwise. Allows you to detect a get(...) or getBinary(...) operation where the object is missing.

Returns:
boolean
getBucket (  )

Get the bucket of this object.

Returns:
RiakBucket
getContentType (  )

Get the content type of this object. This is either text/json, or the provided content type if the object was created via newBinary(...).

Returns:
string
getData (  )

Get the data stored in this object. Will return a associative array, unless the object was constructed with newBinary(...) or getBinary(...), in which case this will return a string.

Returns:
array or string
getKey (  )

Get the key of this object.

Returns:
string
getLinks (  )

Return an array of RiakLink objects.

Returns:
array()
getSibling ( i,
r = NULL 
)

Retrieve a sibling by sibling number.

Parameters:
integer$i- Sibling number.
integer$r- R-Value. Wait until this many partitions have responded before returning to client.
Returns:
RiakObject.
getSiblingCount (  )

Get the number of siblings that this object contains.

Returns:
integer
getSiblings ( r = NULL )

Retrieve an array of siblings.

Parameters:
integer$r- R-Value. Wait until this many partitions have responded before returning to client.
Returns:
array of RiakObject
hasSiblings (  )

Return true if this object has siblings.

Returns:
boolean
link ( params )

Start assembling a Map/Reduce operation.

See also:
RiakMapReduce::link()
Returns:
RiakMapReduce
map ( params )

Start assembling a Map/Reduce operation.

See also:
RiakMapReduce::map()
Returns:
RiakMapReduce
populate ( response,
expected_statuses 
)

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

Returns:
$this
reduce ( params )

Start assembling a Map/Reduce operation.

See also:
RiakMapReduce::reduce()
Returns:
RiakMapReduce
reload ( r = NULL )

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.

Parameters:
integer$r- R-Value, wait for this many partitions to respond before returning to client.
Returns:
$this
removeLink ( obj,
tag = NULL 
)

Remove a link to a RiakObject.

Parameters:
mixed$obj- Either a RiakObject or a RiakLink object.
string$tag-
mixed$obj- Either a RiakObject or a RiakLink object.
string$tag- Optional link tag. (default is bucket name, ignored if $obj is a RiakLink object.)
Returns:
$this
RiakObject ( client,
bucket,
key = NULL 
)

Construct a new RiakObject.

Parameters:
RiakClient$client- A RiakClient object.
RiakBucket$bucket- A RiakBucket object.
string$key- An optional key. If not specified, then key is generated by server when store(...) is called.
setContentType ( content_type )

Set the content type of this object.

Parameters:
string$content_type- The new content type.
Returns:
$this
setData ( data )

Set the data stored in this object. This data will be JSON encoded unless the object was constructed with newBinary(...) or getBinary(...).

Parameters:
mixed$data- The data to store.
Returns:
$data
status (  )

Get the HTTP status from the last operation on this object.

Returns:
integer
store ( w = NULL,
dw = NULL 
)

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.

Parameters:
integer$w- W-value, wait for this many partitions to respond before returning to client.
integer$dw- DW-value, wait for this many partitions to confirm the write before returning to client.
Returns:
$this

The documentation for this class was generated from the following file: