Class DefaultLoadBalancingPolicy
A load balancing policy designed to run against both DSE and Apache Cassandra clusters.
For most workloads, the query plan will be determined in a similar way to TokenAwarePolicy(DCAwareRoundRobinPolicy).
For graph analytics queries, this policy sets the preferred analytics graph server previously obtained by driver as the first host in the query plan. After this host, the query plan is the same as the one returned for other workloads.
Implements
Inherited Members
Namespace: Cassandra
Assembly: Cassandra.dll
Syntax
public class DefaultLoadBalancingPolicy : ILoadBalancingPolicy
Constructors
DefaultLoadBalancingPolicy(string)
Creates a new datacenter aware round robin policy given the name of the local datacenter.
The name of the local datacenter provided must be the local datacenter name as known by the server.
The policy created will ignore all remote hosts.
Declaration
public DefaultLoadBalancingPolicy(string localDc)
Parameters
Type | Name | Description |
---|---|---|
string | localDc | the name of the local datacenter (as known by Cassandra). |
Methods
Distance(Host)
Return the HostDistance for the provided host. This policy consider nodes
in the local datacenter as Local
and the rest
is Ignored
.
Declaration
public HostDistance Distance(Host host)
Parameters
Type | Name | Description |
---|---|---|
Host | host | the host of which to return the distance of. |
Returns
Type | Description |
---|---|
HostDistance | the HostDistance to |
Initialize(ICluster)
Initializes the policy.
Declaration
public void Initialize(ICluster cluster)
Parameters
Type | Name | Description |
---|---|---|
ICluster | cluster |
NewQueryPlan(string, IStatement)
Returns the hosts to used for a query.
Declaration
public IEnumerable<Host> NewQueryPlan(string keyspace, IStatement statement)
Parameters
Type | Name | Description |
---|---|---|
string | keyspace | |
IStatement | statement |
Returns
Type | Description |
---|---|
IEnumerable<Host> |