Class: DCAwareRoundRobinPolicy

policies/loadBalancing~ DCAwareRoundRobinPolicy

Constructor

new DCAwareRoundRobinPolicy(localDcopt, nullable, usedHostsPerRemoteDcopt)

A data-center aware Round-robin load balancing policy. This policy provides round-robin queries over the node of the local data center. It also includes in the query plans returned a configurable number of hosts in the remote data centers, but those are always tried after the local nodes. In other words, this policy guarantees that no host in a remote data center will be queried unless no host in the local data center can be reached.
Parameters:
Name Type Attributes Description
localDc String <optional>
<nullable>
local datacenter name.
usedHostsPerRemoteDc Number <optional>
the number of host per remote datacenter that the policy will yield \ in a newQueryPlan after the local nodes.

Extends

  • LoadBalancingPolicy

Members

localHostsArray :Array

Type:
  • Array

remoteHostsArray :Array

Type:
  • Array

Methods

getDistance(host)

Returns the distance depending on the datacenter.
Parameters:
Name Type Description
host Host

init(client, hosts, callback)

Initializes the load balancing policy.
Parameters:
Name Type Description
client Client
hosts HostMap
callback function

newQueryPlan(keyspace, queryOptions, callback)

It returns an iterator that yields local nodes first and remotes nodes afterwards. The amount of remote nodes returned will depend on the usedHostsPerRemoteDc
Parameters:
Name Type Description
keyspace String Name of the keyspace
queryOptions
callback function