new LoadBalancingPolicy()
Base class for Load Balancing Policies
- Source:
Methods
getDistance(host)
Returns the distance assigned by this policy to the provided host.
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 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 |
executionOptions |
ExecutionOptions | null | The information related to the execution of the request. |
callback |
function | The function to be invoked with the error as first parameter and the host iterator as second parameter. |
- Source: