Official Riak Client for PHP
  • Namespace
  • Class
  • Tree

Namespaces

  • Basho
    • Riak
      • Api
        • Http
          • Translator
      • Command
        • Bucket
        • Builder
          • MapReduce
          • Search
          • TimeSeries
        • DataType
          • Counter
          • Map
          • Set
        • Indexes
        • MapReduce
        • Object
        • Search
          • Index
          • Schema
        • Stats
        • TimeSeries
          • Query
      • DataType
      • Node
        • Builder
      • Search
      • TimeSeries

Classes

  • Riak

Class Riak

This class maintains the list of nodes in the Riak cluster.

$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($command);

$user = $response->getObject();
Namespace: Basho
Author: Christopher Mancini
Located at Riak.php

Methods summary

public
# __construct( array $nodes, array $config = [], Basho\Riak\Api $api = NULL )

Construct a new Client object, defaults to port 8098.

Construct a new Client object, defaults to port 8098.

Parameters

$nodes
an array of Basho\Riak\Node objects
$config
a configuration object
$api

Throws

Basho\Riak\Exception
protected integer
# pickNode( )

Pick a random Node from the ring

Pick a random Node from the ring

You can pick your friends, you can pick your node, but you can't pick your friend's node. :)

Returns

integer

Throws

Basho\Riak\Exception
public Basho\Riak\Node[]
# getNodes( )

Returns

Basho\Riak\Node[]
public mixed
# getConfigValue( $key )

Get value from connection config

Get value from connection config

Parameters

$key

Returns

mixed
public array
# getConfig( )

Returns

array
public Basho\Riak\Command\Response
# execute( Basho\Riak\Command $command )

Execute a Riak command

Execute a Riak command

Parameters

$command

Returns

Basho\Riak\Command\Response

Throws

Basho\Riak\Exception
public Basho\Riak\Node
# getActiveNode( )

Returns

Basho\Riak\Node
public integer
# getActiveNodeIndex( )

Returns

integer
public
# setActiveNodeIndex( integer $activeNodeIndex )

Parameters

$activeNodeIndex
public Basho\Riak\Api|null
# getApi( )

Returns

Basho\Riak\Api|null
public string
# getLastRequest( )

Accessor for the last request issued to the API. For debugging purposes.

Accessor for the last request issued to the API. For debugging purposes.

Returns

string
public
# pickNewNode( )

Pick new active node

Pick new active node

Used when the currently active node fails to complete a command / query

Returns


$this

Throws

Basho\Riak\Exception

Constants summary

string VERSION
# "2.0.3"

Properties summary

protected Basho\Riak\Node[] $nodes

Riak server ring

Riak server ring

# []
protected array $config

Configuration options for this client

Configuration options for this client

# [ 'prefix' => 'riak', 'mapred_prefix' => 'mapred', 'index_prefix' => 'buckets', 'dns_server' => '8.8.8.8', 'max_connect_attempts' => 3, ]
protected integer $activeNodeIndex

The actively connected Riak Node from the ring

The actively connected Riak Node from the ring

# 0
protected Basho\Riak\Api|null $api

API Bridge class to use

API Bridge class to use

# NULL
protected array $inactiveNodes

List of nodes marked inactive

List of nodes marked inactive

# []
protected integer $attempts

Connection attempts made that failed

Connection attempts made that failed

# 0
Official Riak Client for PHP API documentation generated by ApiGen