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

([?String localDc], [Number usedHostPerRemoteDc])

Creates a new instance of DseLoadBalancingPolicy.

Parameters:
Name Type Description
localDc optional nullable String

The local datacenter name.

usedHostPerRemoteDc optional Number

The number of host per remote datacenter that the policy will yield in a newQueryPlan after the local nodes.

Methods

DseLoadBalancingPolicy.createAsWrapper

(LoadBalancingPolicy childPolicy)

Creates a new instance of DseLoadBalancingPolicy wrapping the provided child policy.

Static
This function is static
Parameters:
Name Type Description
childPolicy LoadBalancingPolicy

The child load balancing policy to be used.

Returns:
Type Description
DseLoadBalancingPolicy

A new DseLoadBalancingPolicy instance.

getDistance

(Host host)

Uses the child policy to return the distance to the host.

Parameters:
Name Type Description
host Host

init

(Client client, HostMap hosts, function 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.