Class: DseLoadBalancingPolicy

policies/loadBalancing~ DseLoadBalancingPolicy

A load balancing policy designed to run against DSE cluster that provides token and datacenter awareness.

For most executions, the query plan is determined by the token and the datacenter considered local. For graph analytics queries, it uses the preferred analytics graph server previously obtained by driver as first host in the query plan.

You can use this policy to wrap a custom load-balancing policy using DseLoadBalancingPolicy.createAsWrapper(childPolicy) static method.

Constructor

new DseLoadBalancingPolicy(localDcopt, nullable, usedHostPerRemoteDcopt)

Creates a new instance of DseLoadBalancingPolicy.
Parameters:
Name Type Attributes Description
localDc String <optional>
<nullable>
The local datacenter name.
usedHostPerRemoteDc Number <optional>
The number of host per remote datacenter that the policy will yield in a newQueryPlan after the local nodes.

Methods

(static) createAsWrapper(childPolicy) → {DseLoadBalancingPolicy}

Creates a new instance of DseLoadBalancingPolicy wrapping the provided child policy.
Parameters:
Name Type Description
childPolicy LoadBalancingPolicy The child load balancing policy to be used.
Returns:
A new DseLoadBalancingPolicy instance.
Type
DseLoadBalancingPolicy

getDistance(host)

Uses the child policy to return the distance to the host.
Parameters:
Name Type Description
host Host

init(client, hosts, callback)

Initializes the load balancing policy.
Parameters:
Name Type Description
client Client
hosts HostMap
callback function

newQueryPlan()

Returns the hosts to used for a query.