Constructor
new DefaultLoadBalancingPolicy(optionsopt)
Creates a new instance of DefaultLoadBalancingPolicy
.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
String | Object |
<optional> |
The local data center name or the optional policy options object. Note that when providing the local data center name, it overrides Properties
|
- Source:
Methods
getDistance(host)
Returns the distance assigned by this policy to the provided host, relatively to the client instance.
Parameters:
Name | Type | Description |
---|---|---|
host |
Host |
- Source:
getOptions()
Gets an associative array containing the policy options.
- Source:
init(client, hosts, callback)
Initializes the load balancing policy, called after the driver obtained the information of the cluster.
Parameters:
Name | Type | Description |
---|---|---|
client |
Client | |
hosts |
HostMap | |
callback |
function |
- Source:
newQueryPlan(keyspace, executionOptions, callback)
Returns a host iterator to be used for a query execution.
Parameters:
Name | Type | Description |
---|---|---|
keyspace |
String | |
executionOptions |
ExecutionOptions | |
callback |
function |
- Source:
(generator) yieldReplicasFirst(replicas)
Yields the local replicas followed by the rest of local nodes.
Parameters:
Name | Type | Description |
---|---|---|
replicas |
Array.<Host> | The local replicas |
- Source: