PHP Class Basho\Riak\Node\Builder

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();
Show file Open project: basho/riak-php-client

Protected Properties

Property Type Description
$config Config | null Internal storage

Public Methods

Method Description
__construct ( )
atHost ( $host ) Build with host address
build ( ) : Node Build node
buildCluster ( array $hosts = ['localhost'] ) : Node[] Build distributed cluster
buildLocalhost ( array $ports = [8087] ) : Node[] Build local node cluster
getConfig ( ) : Config | null
onPort ( $port ) Build node objects with configuration to use a specific port number
usingCertificateAuthentication ( $certificate, string $password = '' ) usingCertificateAuthentication
usingPamAuthentication ( $user ) usingPamAuthentication
usingPasswordAuthentication ( $user, $pass = '' ) usingPasswordAuthentication
usingTrustAuthentication ( string $user = '' ) usingTrustAuthentication
withCertificateAuthorityDirectory ( $ca_directory ) withCertificateAuthorityDirectory
withCertificateAuthorityFile ( $ca_file ) withCertificateAuthorityDirectory
withConnectionTimeout ( $timeout ) Client side connection timeout for requests
withPrivateKey ( $private_key, $password = '' )
withStreamTimeout ( $timeout ) Client side socket read/write timeout for requests

Protected Methods

Method Description
validate ( ) Builder configuration validation

Method Details

__construct() public method

public __construct ( )

atHost() public method

Build node objects with configuration to use a specific host address
public atHost ( $host )
$host

build() public method

Validate configuration for a single node object, then build it
public build ( ) : Node
return Basho\Riak\Node

buildCluster() public method

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.
public buildCluster ( array $hosts = ['localhost'] ) : Node[]
$hosts array
return Basho\Riak\Node[]

buildLocalhost() public method

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.
public buildLocalhost ( array $ports = [8087] ) : Node[]
$ports array
return Basho\Riak\Node[]

getConfig() public method

public getConfig ( ) : Config | null
return Config | null

onPort() public method

Build node objects with configuration to use a specific port number
public onPort ( $port )
$port

usingCertificateAuthentication() public method

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
public usingCertificateAuthentication ( $certificate, string $password = '' )
$certificate
$password string

usingPamAuthentication() public method

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.
public usingPamAuthentication ( $user )
$user

usingPasswordAuthentication() public method

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.
public usingPasswordAuthentication ( $user, $pass = '' )
$user
$pass

usingTrustAuthentication() public method

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.
public usingTrustAuthentication ( string $user = '' )
$user string

validate() protected method

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

withCertificateAuthorityDirectory() public method

Directory where the CA file can be found. A Certificate Authority file is required for any secure connections to Riak
public withCertificateAuthorityDirectory ( $ca_directory )
$ca_directory

withCertificateAuthorityFile() public method

Path to CA file. A Certificate Authority file is required for any secure connections to Riak
public withCertificateAuthorityFile ( $ca_file )
$ca_file

withConnectionTimeout() public method

Client side connection timeout for requests
public withConnectionTimeout ( $timeout )
$timeout

withPrivateKey() public method

public withPrivateKey ( $private_key, $password = '' )

withStreamTimeout() public method

Client side socket read/write timeout for requests
public withStreamTimeout ( $timeout )
$timeout

Property Details

$config protected property

Internal storage
protected Config,Basho\Riak\Node|null $config
return Config | null