RiakNode.Builder Class
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
()
Item Index
Methods
buildNodes
-
addresses
-
[options]
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:
withAuth
-
auth
Set the authentication information for connections made by this node.
Parameters:
-
auth
ObjectSet the authentication information for connections made by this node.
-
user
StringRiak username.
-
[password]
String optionalRiak password. Not required if using user cert.
-
[pfx]
String | Buffer optionalA string or buffer holding the PFX or PKCS12 encoded private key, certificate and CA certificates.
-
[key]
String | Buffer optionalA string holding the PEM encoded private key.
-
[passphrase]
String optionalA string of passphrase for the private key or pfx.
-
[cert]
String | Buffer optionalA string holding the PEM encoded certificate.
-
[ca]
String | String | Buffer optionalEither a string or list of strings of PEM encoded CA certificates to trust.
-
[crl]
String | String | Buffer optionalEither a string or list of strings of PEM encoded CRLs (Certificate Revocation List).
-
[rejectUnauthorized]
Boolean optionalA boolean indicating whether a server should automatically reject clients with invalid certificates. Only applies to servers with requestCert enabled. * @return {RiakNode.Builder}
-
withConnectionTimeout
-
connectionTimeout
Set the connection timeout used when making new connections.
Parameters:
-
connectionTimeout
Number- timeout in milliseconds (default: 3000).
Returns:
withCork
-
[cork=true]
Set whether to use the cork/uncork socket functions.
Parameters:
-
[cork=true]
Boolean optionaluse cork/uncork. Default is true.
withExternalLoadBalancer
-
[externalLoadBalancer=true]
Set whether this RiakNode connects to an external load balancer.
Parameters:
-
[externalLoadBalancer=true]
Boolean optionalconnects to external load balancer. Default is false.
withHealthCheck
-
healthCheck
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
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
Set the maximum number of connections allowed.
Parameters:
-
maxConnections
Number- maximum number of connections to allow (default: 10000)
Returns:
withMinConnections
-
minConnections
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
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
Set the remote port for this RiakNode.
Parameters:
-
port
Number- remote port of the Riak node (default: 8087)
Returns:
withRequestTimeout
-
requestTimeout
Set the request timeout used when executing commands.
Parameters:
-
requestTimeout
Number- timeout in milliseconds (default: 5000).