C# Class Dse.Policies.DseLoadBalancingPolicy

A load balancing policy designed to run against DSE cluster.

For most executions, the query plan will be determined by the child load balancing policy. Except for some cases, like graph analytics queries, for which it uses the preferred analytics graph server previously obtained by driver as first host in the query plan.

Inheritance: ILoadBalancingPolicy
显示文件 Open project: datastax/csharp-driver-dse Class Usage Examples

Public Methods

Method Description
CreateDefault ( ) : DseLoadBalancingPolicy

Creates the default load balancing policy, using Cassandra.Policies.DefaultLoadBalancingPolicy as child policy.

Distance ( Cassandra.Host host ) : HostDistance

Returns the distance as determined by the child policy.

DseLoadBalancingPolicy ( ILoadBalancingPolicy childPolicy ) : System

Creates a new instance of DseLoadBalancingPolicy wrapping the provided child policy.

DseLoadBalancingPolicy ( string localDc, int usedHostsPerRemoteDc ) : System

Creates a new instance of DseLoadBalancingPolicy given the name of the local datacenter and the amount of host per remote datacenter to use for failover for the local hosts.

Initialize ( ICluster cluster ) : void

Initializes the policy.

NewQueryPlan ( string keyspace, IStatement statement ) : IEnumerable

Returns the hosts to used for a query.

Private Methods

Method Description
YieldPreferred ( string keyspace, TargettedSimpleStatement statement ) : IEnumerable

Method Details

CreateDefault() public static method

Creates the default load balancing policy, using Cassandra.Policies.DefaultLoadBalancingPolicy as child policy.
public static CreateDefault ( ) : DseLoadBalancingPolicy
return DseLoadBalancingPolicy

Distance() public method

Returns the distance as determined by the child policy.
public Distance ( Cassandra.Host host ) : HostDistance
host Cassandra.Host
return HostDistance

DseLoadBalancingPolicy() public method

Creates a new instance of DseLoadBalancingPolicy wrapping the provided child policy.
public DseLoadBalancingPolicy ( ILoadBalancingPolicy childPolicy ) : System
childPolicy ILoadBalancingPolicy
return System

DseLoadBalancingPolicy() public method

Creates a new instance of DseLoadBalancingPolicy given the name of the local datacenter and the amount of host per remote datacenter to use for failover for the local hosts.
public DseLoadBalancingPolicy ( string localDc, int usedHostsPerRemoteDc ) : System
localDc string The name of the local datacenter (case-sensitive)
usedHostsPerRemoteDc int /// The amount of host per remote datacenter that the policy should yield in a new query plan after the local /// nodes. ///
return System

Initialize() public method

Initializes the policy.
public Initialize ( ICluster cluster ) : void
cluster ICluster
return void

NewQueryPlan() public method

Returns the hosts to used for a query.
public NewQueryPlan ( string keyspace, IStatement statement ) : IEnumerable
keyspace string
statement IStatement
return IEnumerable