Was this page helpful?
LoadBalancingPolicy¶
policies/loadBalancing~LoadBalancingPolicy()
Base class for Load Balancing Policies
Constructor¶
new LoadBalancingPolicy()
Methods¶
getDistance()
Returns the distance assigned by this policy to the provided host.
getOptions()
Gets an associative array containing the policy options.
init()
Initializes the load balancing policy, called after the driver obtained the information of the cluster.
newQueryPlan(keyspace, executionOptions, 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 |
Name of currently logged keyspace at |
|
executionOptions |
The information related to the execution of the request. |
|
callback |
The function to be invoked with the error as first parameter and the host iterator as second parameter. |