Constructor

new

LoadBalancingPolicy

()

Base class for Load Balancing Policies

Methods

getDistance

(Host host)

Returns the distance assigned by this policy to the provided host.

Parameters:
Name Type Description
host Host

init

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

newQueryPlan

(String keyspace, QueryOptions or null queryOptions, function callback)

Returns an iterator with the hosts for a new query. Each new query will call this method. The first host in the result will then be used to perform the query.

Parameters:
Name Type Description
keyspace String

Name of currently logged keyspace at Client level.

queryOptions QueryOptions or null

Options related to this query execution.

callback function

The function to be invoked with the error as first parameter and the host iterator as second parameter.