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

  • Builder
  • Config

Class Builder

This class follows the Builder design pattern and is the preferred method for creating Basho\Riak\Node objects for connecting to your Riak node cluster.

// simple local development / testing cluster
 use Basho\Riak\Node;

 $nodes = (new Node\Builder)
     ->buildLocalhost([10018, 10028, 10038, 10048, 10058]);
// password authentication to production cluster
 use Basho\Riak\Node;

 $nodes = (new Node\Builder)
     ->onPort(8098)
     ->usingPasswordAuthentication('riakuser', 'riakpassword')
     ->withCertificateAuthorityFile(getcwd() . '/path/to/cacert.pem')
     ->buildCluster(['riak1.company.int','riak2.company.int','riak3.company.int']);
// certificate authentication to production load balanced cluster
 use Basho\Riak\Node;

 $node = (new Node\Builder)
     ->atHost('riak.company.int')
     ->onPort(8098)
     ->usingCertificateAuthentication(getcwd() . '/path/to/client.crt')
     ->withCertificateAuthorityFile(getcwd() . '/path/to/cacert.pem')
     ->build();
// pam authentication to production load balanced cluster
 use Basho\Riak\Node;

 $node = (new Node\Builder)
     ->atHost('riak.company.int')
     ->onPort(8098)
     ->usingPamAuthentication('riakuser')
     ->withCertificateAuthorityFile(getcwd() . '/path/to/cacert.pem')
     ->build();
Namespace: Basho\Riak\Node
Author: Christopher Mancini
Located at Riak/Node/Builder.php

Methods summary

public
# __construct( )
public
# usingTrustAuthentication( string $user = '' )

usingTrustAuthentication

usingTrustAuthentication

Build nodes with trust authentication

User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL is required to communicate with your Riak nodes.

Parameters

$user

Returns


$this
public
# usingPasswordAuthentication( $user, $pass = '' )

usingPasswordAuthentication

usingPasswordAuthentication

Build nodes with password authentication

User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL is required to communicate with your Riak nodes.

Parameters

$user
$pass

Returns


$this
public
# usingCertificateAuthentication( $certificate, string $password = '' )

usingCertificateAuthentication

usingCertificateAuthentication

Build nodes with certificate authentication

User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL is required to communicate with your Riak nodes.

CURRENTLY NOT SUPPORTED OVER THE RIAK HTTP API

Parameters

$certificate
$password

Returns


$this

Throws

Basho\Riak\Node\Builder\Exception
public
# usingPamAuthentication( $user )

usingPamAuthentication

usingPamAuthentication

Build nodes with PAM authentication

User authentication and access rules are only available in Riak versions 2 and above. To use this feature, TSL is required to communicate with your Riak nodes.

Parameters

$user

Returns


$this
public
# withCertificateAuthorityFile( $ca_file )

withCertificateAuthorityDirectory

withCertificateAuthorityDirectory

Path to CA file. A Certificate Authority file is required for any secure connections to Riak

Parameters

$ca_file

Returns


$this
public
# withCertificateAuthorityDirectory( $ca_directory )

withCertificateAuthorityDirectory

withCertificateAuthorityDirectory

Directory where the CA file can be found. A Certificate Authority file is required for any secure connections to Riak

Parameters

$ca_directory

Returns


$this
public
# withPrivateKey( $private_key, $password = '' )
public
# withConnectionTimeout( $timeout )

Client side connection timeout for requests

Client side connection timeout for requests

Parameters

$timeout
public Basho\Riak\Node\Config|null
# getConfig( )

Returns

Basho\Riak\Node\Config|null
public Basho\Riak\Node[]
# buildCluster( array $hosts = ['localhost'] )

Build distributed cluster

Build distributed cluster

Build node objects configured to listen on the same port but different hosts. Commonly used in staging and production environments where you have multiple Riak nodes on multiple machines / vms.

Parameters

$hosts

Returns

Basho\Riak\Node[]
public Basho\Riak\Node
# build( )

Build node

Build node

Validate configuration for a single node object, then build it

Returns

Basho\Riak\Node
protected
# validate( )

Builder configuration validation

Builder configuration validation

Checks the current configuration of the Node Builder for errors. This method should be executed before each Node is built.

Throws

Basho\Riak\Node\Builder\Exception
public
# atHost( $host )

Build with host address

Build with host address

Build node objects with configuration to use a specific host address

Parameters

$host

Returns


$this
public Basho\Riak\Node[]
# buildLocalhost( array $ports = [8087] )

Build local node cluster

Build local node cluster

Build multiple node objects configured with the same host address but different ports. Commonly used in development environments where you have multiple Riak nodes on a single machine / vm.

Parameters

$ports

Returns

Basho\Riak\Node[]
public
# onPort( $port )

Build node objects with configuration to use a specific port number

Build node objects with configuration to use a specific port number

Parameters

$port

Returns


$this

Properties summary

protected Basho\Riak\Node\Config|null $config

Internal storage

Internal storage

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