Bucket

Bucket

category

Basho

author

Riak team (https://github.com/basho/riak-php-client/contributors)

Methods

Construct a Bucket object

__construct(\Basho\Riak\Riak $client, string $name) 

Arguments

$client

\Basho\Riak\Riak

Riak Client object

$name

string

Bucket name

Get the bucket name.

getName() : string

Response

string

Get the R-value for this bucket

getR($r = NULL) : integer

Returns the buckets R-value If it is set, otherwise return the R-value for the client.

Arguments

$r

Response

integer

Set the R-value for this bucket

setR(integer $r) : $this

get(...) and getBinary(...) operations that do not specify an R-value will use this value.

see

Arguments

$r

integer

  • The new R-value.

Response

$this

Get the W-value for this bucket

getW($w) : integer

If it is set for this bucket, otherwise return the W-value for the client.

Arguments

$w

Response

integer

Set the W-value for this bucket

setW(integer $w) : $this

See setR(...) for more information.

Arguments

$w

integer

  • The new W-value.

Response

$this

Get the DW-value for this bucket

getDW($dw) : integer

If it is set for this bucket, otherwise return the DW-value for the client.

Arguments

$dw

Response

integer

Set the DW-value for this bucket.

setDW(integer $dw) : $this

See setR(...) for more information.

Arguments

$dw

integer

  • The new DW-value

Response

$this

Create a new Riak object that will be stored as JSON.

newObject(string $key, object $data = NULL) : Object

Arguments

$key

string

  • Name of the key.

$data

object

  • The data to store. (default NULL)

Response

Object

Create a new Riak object that will be stored as plain text/binary.

newBinary(string $key, object $data, string $content_type = 'application/json') : Object

Arguments

$key

string

  • Name of the key.

$data

object

  • The data to store.

$content_type

string

  • The content type of the object. (default 'application/json')

Response

Object

Retrieve a JSON-encoded object from Riak.

get(string $key, int $r = NULL) : Object

Arguments

$key

string

  • Name of the key.

$r

int

  • R-Value of the request (defaults to bucket's R)

Response

Object

Retrieve a binary/string object from Riak.

getBinary(string $key, int $r = NULL) : Object

Arguments

$key

string

  • Name of the key.

$r

int

  • R-Value of the request (defaults to bucket's R)

Response

Object

Set the N-value for this bucket

setNVal(integer $nval) 

The N-value is the number of replicas that will be written of each object in the bucket. Set this once before you write any data to the bucket, and never change it again, otherwise unpredictable things could happen. This should only be used if you know what you are doing.

Arguments

$nval

integer

  • The new N-Val.

Retrieve the N-value for this bucket.

getNVal() : integer

Response

integer

Allow conflicting data to be stored

setAllowMultiples(boolean $bool) 

If set to true, then writes with conflicting data will be stored and returned to the client. This situation can be detected by calling hasSiblings() and getSiblings(). This should only be used if you know what you are doing.

Arguments

$bool

boolean

  • True to store and return conflicting writes.

Retrieve the 'allow multiples' setting.

getAllowMultiples() : Boolean

Response

Boolean

Set a bucket property

setProperty(string $key, mixed $value) 

This should only be used if you know what you are doing.

Arguments

$key

string

  • Property to set.

$value

mixed

  • Property value.

Retrieve a bucket property.

getProperty(string $key) : mixed

Arguments

$key

string

  • The property to retrieve.

Response

mixed

Set multiple bucket properties in one call

setProperties(array $props) 

This should only be used if you know what you are doing.

Arguments

$props

array

  • An associative array of $key=>$value.

Retrieve an associative array of all bucket properties.

getProperties() : Array

Response

Array

Retrieve an array of all keys in this bucket.

getKeys() : Array

Note: this operation is pretty slow.

Response

Array

Search a secondary index

indexSearch(string $indexName, string $indexType, string|int $startOrExact, $end = NULL, $dedupe = false) : array
author

Eric Stevens estevens@taglabsinc.com

Arguments

$indexName

string

  • The name of the index to search

$indexType

string

  • The type of index ('int' or 'bin')

$startOrExact

string|int

$end

$dedupe

Response

array

of Links