PHP Class Basho\Riak

$nodes = (new Node\Builder) ->atHost('localhost') ->onPort(8098) ->build() $riak = new Riak($nodes); $command = (new Command\Builder\FetchObject($riak)) ->buildLocation('username', 'users') ->build(); $response = $command->execute(); $user = $response->getObject();
Exibir arquivo Open project: basho/riak-php-client Class Usage Examples

Protected Properties

Property Type Description
$activeNodeIndex integer The actively connected Riak Node from the ring
$api Basho\Riak\Api | null API Bridge class to use
$attempts integer Connection attempts made that failed
$config array Configuration options for this client
$inactiveNodes array List of nodes marked inactive
$nodes Basho\Riak\Node[] Riak server ring

Public Methods

Method Description
__construct ( array $nodes, array $config = [], Basho\Riak\Api $api = NULL ) Construct a new Client object, defaults to port 8098.
execute ( Basho\Riak\Command $command ) : Basho\Riak\Command\Response Execute a Riak command
getActiveNode ( ) : Node
getActiveNodeIndex ( ) : integer
getApi ( ) : Basho\Riak\Api | null
getConfig ( ) : array
getConfigValue ( $key ) : mixed Get value from connection config
getLastRequest ( ) : string Accessor for the last request issued to the API. For debugging purposes.
getNodes ( ) : Node[]
pickNewNode ( ) Pick new active node
setActiveNodeIndex ( integer $activeNodeIndex )

Protected Methods

Method Description
pickNode ( ) : integer Pick a random Node from the ring

Method Details

__construct() public method

Construct a new Client object, defaults to port 8098.
public __construct ( array $nodes, array $config = [], Basho\Riak\Api $api = NULL )
$nodes array an array of Basho\Riak\Node objects
$config array a configuration object
$api Basho\Riak\Api

execute() public method

Execute a Riak command
public execute ( Basho\Riak\Command $command ) : Basho\Riak\Command\Response
$command Basho\Riak\Command
return Basho\Riak\Command\Response

getActiveNode() public method

public getActiveNode ( ) : Node
return Basho\Riak\Node

getActiveNodeIndex() public method

public getActiveNodeIndex ( ) : integer
return integer

getApi() public method

public getApi ( ) : Basho\Riak\Api | null
return Basho\Riak\Api | null

getConfig() public method

public getConfig ( ) : array
return array

getConfigValue() public method

Get value from connection config
public getConfigValue ( $key ) : mixed
$key
return mixed

getLastRequest() public method

Accessor for the last request issued to the API. For debugging purposes.
public getLastRequest ( ) : string
return string

getNodes() public method

public getNodes ( ) : Node[]
return Basho\Riak\Node[]

pickNewNode() public method

Used when the currently active node fails to complete a command / query
public pickNewNode ( )

pickNode() protected method

You can pick your friends, you can pick your node, but you can't pick your friend's node. :)
protected pickNode ( ) : integer
return integer

setActiveNodeIndex() public method

public setActiveNodeIndex ( integer $activeNodeIndex )
$activeNodeIndex integer

Property Details

$activeNodeIndex protected_oe property

The actively connected Riak Node from the ring
protected int $activeNodeIndex
return integer

$api protected_oe property

API Bridge class to use
protected Api,Basho\Riak|null $api
return Basho\Riak\Api | null

$attempts protected_oe property

Connection attempts made that failed
protected int $attempts
return integer

$config protected_oe property

Configuration options for this client
protected array $config
return array

$inactiveNodes protected_oe property

List of nodes marked inactive
protected array $inactiveNodes
return array

$nodes protected_oe property

Riak server ring
protected Node[],Basho\Riak $nodes
return Basho\Riak\Node[]