API Docs for: 2.2.2
Show:

RiakNode.Builder Class

Module: Core

A Builder for constructing RiakNode instances.

Rather than having to manually construct the options and instantiating a RiakNode directly, this builder may be used.

 var riakNode = new RiakNode.Builder().withRemotePort(9999).build();

Constructor

RiakNode.Builder

()

Methods

build

() RiakNode

Builds a RiakNode instance.

Returns:

buildNodes

(
  • addresses
  • [options]
)
Array/RiakNode static

Static factory for constructing a set of RiakNodes.

To create a set of RiakNodes with the same options:

 var options = new RiakNode.Builder().withMinConnections(10);
 var nodes = RiakNode.buildNodes(['192.168.1.1', '192.168.1.2'], options);

options can be manually constructed or an instance of the Builder.

Parameters:

  • addresses String
    • an array of IP|hostname[:port]
  • [options] Object optional
    • the options to use for all RiakNodes.

Returns:

Array/RiakNode:

withAuth

(
  • auth
)

Set the authentication information for connections made by this node.

Parameters:

  • auth Object

    Set the authentication information for connections made by this node.

    • user String

      Riak username.

    • [password] String optional

      Riak password. Not required if using user cert.

    • [pfx] String | Buffer optional

      A string or buffer holding the PFX or PKCS12 encoded private key, certificate and CA certificates.

    • [key] String | Buffer optional

      A string holding the PEM encoded private key.

    • [passphrase] String optional

      A string of passphrase for the private key or pfx.

    • [cert] String | Buffer optional

      A string holding the PEM encoded certificate.

    • [ca] String | String | Buffer optional

      Either a string or list of strings of PEM encoded CA certificates to trust.

    • [crl] String | String | Buffer optional

      Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List).

    • [rejectUnauthorized] Boolean optional

      A boolean indicating whether a server should automatically reject clients with invalid certificates. Only applies to servers with requestCert enabled. * @return {RiakNode.Builder}

withConnectionTimeout

(
  • connectionTimeout
)
RiakNode.Builder

Set the connection timeout used when making new connections.

Parameters:

  • connectionTimeout Number
    • timeout in milliseconds (default: 3000).

Returns:

withCork

(
  • [cork=true]
)
chainable

Set whether to use the cork/uncork socket functions.

Parameters:

  • [cork=true] Boolean optional

    use cork/uncork. Default is true.

withExternalLoadBalancer

(
  • [externalLoadBalancer=true]
)
chainable

Set whether this RiakNode connects to an external load balancer.

Parameters:

  • [externalLoadBalancer=true] Boolean optional

    connects to external load balancer. Default is false.

withHealthCheck

(
  • healthCheck
)
chainable

Set the command to be used for a health check.

If this RiakNode performs a health check, a new connection is made and a command performed. The default is to send a Ping command but any command can be used. If it completes successfully the health check is considered a success.

Parameters:

  • healthCheck Object
    • a command to execute as a health check.

withIdleTimeout

(
  • idleTimeout
)
RiakNode.Builder

Set the idle timeout used to reap inactive connections. Any connection that has been idle for this amount of time becomes eligible to be closed and discarded excluding the number set via withMinConnections().

Parameters:

  • idleTimeout Number
    • the timeout in milliseconds (default: 10000)

Returns:

withMaxConnections

(
  • maxConnections
)
RiakNode.Builder

Set the maximum number of connections allowed.

Parameters:

  • maxConnections Number
    • maximum number of connections to allow (default: 10000)

Returns:

withMinConnections

(
  • minConnections
)
RiakNode.Builder

Set the minimum number of active connections to maintain. These connections are exempt from the idle timeout.

Parameters:

  • minConnections Number
    • number of connections to maintain (default: 1)

Returns:

withRemoteAddress

(
  • address
)
RiakNode.Builder

Set the remote address for the RiakNode.

Parameters:

  • address String
    • IP or hostanme of the Riak node (default: 127.0.0.1)

Returns:

withRemotePort

(
  • port
)
RiakNode.Builder

Set the remote port for this RiakNode.

Parameters:

  • port Number
    • remote port of the Riak node (default: 8087)

Returns:

withRequestTimeout

(
  • requestTimeout
)
RiakNode.Builder

Set the request timeout used when executing commands.

Parameters:

  • requestTimeout Number
    • timeout in milliseconds (default: 5000).

Returns: