$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();
Показать файл
Открыть проект
Примеры использования класса
Свойство | Тип | Описание | |
---|---|---|---|
$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 | Riak server ring |
Метод | Описание | |
---|---|---|
__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 ( ) : |
||
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 ( ) : |
||
pickNewNode ( ) | Pick new active node | |
setActiveNodeIndex ( integer $activeNodeIndex ) |
Метод | Описание | |
---|---|---|
pickNode ( ) : integer | Pick a random Node from the ring |
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 |
public execute ( Basho\Riak\Command $command ) : Basho\Riak\Command\Response | ||
$command | Basho\Riak\Command | |
Результат | Basho\Riak\Command\Response |
public getConfigValue ( $key ) : mixed | ||
$key | ||
Результат | mixed |
public getLastRequest ( ) : string | ||
Результат | string |
public pickNewNode ( ) |
public setActiveNodeIndex ( integer $activeNodeIndex ) | ||
$activeNodeIndex | integer |
protected int $activeNodeIndex | ||
Результат | integer |
protected Api,Basho\Riak|null $api | ||
Результат | Basho\Riak\Api | null |
protected int $attempts | ||
Результат | integer |
protected array $config | ||
Результат | array |
protected array $inactiveNodes | ||
Результат | array |