Abstract
Actual load balancing policies don’t need to extend this class, only implement its methods. This class exists for documentation purposes only.

Inherits

Object

Direct Known Subclasses

Methods

setup

(cluster)

Allows policy to initialize with the cluster instance. This method is called once before connecting to the cluster.

Void
Return value of this method is ignored.
Parameters:
Name Type Details
cluster Cluster current cluster instance

teardown

(cluster)

Allows policy to release any external resources it might be holding. This method is called once the cluster has been terminated after calling Cluster#close

Void
Return value of this method is ignored.
Parameters:
Name Type Details
cluster Cluster current cluster instance

host_up

(host)
See Also:

host_down

(host)
See Also:

host_found

(host)

host_lost

(host)
See Also:

distance

(host)

Returns a distance that determines how many connections (if any) the driver will open to the host.

Parameters:
Name Type Details
host Host a host instance
Returns:
Type Details
Symbol distance to host. Must be one of DISTANCES

plan

(keyspace, statement, options)

Load balancing plan is used to determine the order in which hosts should be tried in case of a network failure.

Note
Hosts that should be ignored, must not be included in the Plan
Parameters:
Name Type Details
keyspace String current keyspace of the Session
statement Statement actual statement to be executed
options Execution::Options execution options to be used
Returns:
Type Details
LoadBalancing::Plan a load balancing plan
Raises:
Type Details
NotImplementedError override this method to return a plan