• DataStax C# Driver for Apache Cassandra API Documentation
Search Results for

    Show / Hide Table of Contents
    • Cassandra
      • AesColumnEncryptionPolicy
      • AesColumnEncryptionPolicy.AesKeyAndIV
      • AggregateMetadata
      • AlreadyExistsException
      • AtomicMonotonicTimestampGenerator
      • AtomicMonotonicWinApiTimestampGenerator
      • AuthenticationException
      • BaseColumnEncryptionPolicy<TKey>
      • BaseColumnEncryptionPolicy<TKey>.ColMetadataKey
      • BatchStatement
      • BatchType
      • BigIntegerTypeAdapter
      • BoundStatement
      • Builder
      • BusyPoolException
      • CassandraConnectionStringBuilder
      • ClientOptions
      • Cluster
      • ColumnDesc
      • ColumnEncryptionInvalidTypeError
      • ColumnEncryptionMetadata
      • ColumnTypeCode
      • CompressionType
      • Configuration
      • ConsistencyLevel
      • ConstantReconnectionPolicy
      • ConstantSpeculativeExecutionPolicy
      • CqlColumn
      • CustomColumnInfo
      • DataCollectionMetadata
      • DataCollectionMetadata.SortOrder
      • DCAwareRoundRobinPolicy
      • DecimalTypeAdapter
      • DefaultLoadBalancingPolicy
      • DefaultRetryPolicy
      • Diagnostics
      • DowngradingConsistencyRetryPolicy
      • DriverException
      • DriverInternalError
      • Duration
      • DynamicCompositeTypeAdapter
      • EC2MultiRegionTranslator
      • EncryptedValue
      • ExecutionException
      • ExecutionInfo
      • ExponentialReconnectionPolicy
      • Extensions
      • FallthroughRetryPolicy
      • FixedReconnectionPolicy
      • FunctionFailureException
      • FunctionMetadata
      • GraphProtocol
      • Host
      • HostDistance
      • HostsEventArgs
      • HostsEventArgs.Kind
      • HostsEventHandler
      • IAddressTranslator
      • IAuthenticator
      • IAuthProvider
      • IAuthProviderNamed
      • ICluster
      • IColumnEncryptionPolicy
      • IColumnInfo
      • IdempotenceAwareRetryPolicy
      • IExecutionProfile
      • IExecutionProfileBuilder
      • IExecutionProfileOptions
      • IExtendedRetryPolicy
      • IFrameCompressor
      • IInitializer
      • ILoadBalancingPolicy
      • IndexMetadata
      • IndexMetadata.IndexKind
      • InitFatalErrorException
      • InvalidConfigurationInQueryException
      • InvalidQueryException
      • InvalidTypeException
      • IReconnectionPolicy
      • IReconnectionSchedule
      • IRetryPolicy
      • IsBootstrappingException
      • ISession
      • ISessionState
      • ISpeculativeExecutionPlan
      • ISpeculativeExecutionPolicy
      • IStatement
      • ITimestampGenerator
      • ITypeAdapter
      • KeyspaceMetadata
      • KeyType
      • ListColumnInfo
      • LocalDate
      • LocalTime
      • Logger
      • LoggingRetryPolicy
      • MapColumnInfo
      • MaterializedViewMetadata
      • Metadata
      • MetadataSyncOptions
      • MetricsExtensions
      • MonitorReportingOptions
      • NoHostAvailableException
      • NoneAuthProvider
      • NoSpeculativeExecutionPolicy
      • NullTypeAdapter
      • OperationTimedOutException
      • OverloadedException
      • PlainTextAuthProvider
      • Policies
      • PoolingOptions
      • PreparedQueryNotFoundException
      • PreparedStatement
      • PreparedStatementIdMismatchException
      • ProtocolErrorException
      • ProtocolOptions
      • ProtocolVersion
      • QueryExecutionException
      • QueryOptions
      • QueryProtocolOptions
      • QueryProtocolOptions.QueryFlags
      • QueryTimeoutException
      • QueryTrace
      • QueryTrace.Event
      • QueryValidationException
      • ReadFailureException
      • ReadTimeoutException
      • RegularStatement
      • ReplicationStrategies
      • RequestInvalidException
      • RetryDecision
      • RetryDecision.RetryDecisionType
      • RetryLoadBalancingPolicy
      • RetryLoadBalancingPolicyEventArgs
      • RoundRobinPolicy
      • RoutingKey
      • Row
      • RowSet
      • RowSetMetadata
      • SchemaChangedEventArgs
      • SchemaChangedEventArgs.Kind
      • SchemaChangedEventHandler
      • ServerErrorException
      • Session
      • SetColumnInfo
      • SimpleStatement
      • SocketOptions
      • SSLOptions
      • Statement
      • SyntaxError
      • TableColumn
      • TableMetadata
      • TableOptions
      • TimeUuid
      • TokenAwarePolicy
      • ToManyConnectionsPerHost
      • TraceRetrievalException
      • TruncateException
      • TupleColumnInfo
      • TypeAdapters
      • UdtColumnInfo
      • UdtMap
      • UdtMap<T>
      • UdtMappingDefinitions
      • UnauthorizedException
      • UnavailableException
      • Unset
      • WriteFailureException
      • WriteTimeoutException
    • Cassandra.AppMetrics
      • DriverAppMetricsOptions
    • Cassandra.AppMetrics.MetricTypes
      • IAppMetricsCounter
      • IAppMetricsGauge
      • IAppMetricsMeter
      • IAppMetricsMetric
      • IAppMetricsTimer
    • Cassandra.AppMetrics.MetricValues
      • IAppMetricsHistogramValue
      • IAppMetricsMeterValue
      • IAppMetricsMetricWithValue<T>
      • IAppMetricsTimerValue
    • Cassandra.Data
      • CqlBatchTransaction
      • CqlCommand
      • CqlConnection
      • CqlDataAdapter
      • CqlParameter
      • CqlParameterCollection
      • CqlProviderFactory
      • CqlReader
    • Cassandra.Data.Linq
      • AllowFilteringAttribute
      • Batch
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CompactStorageAttribute
      • CounterAttribute
      • CqlArgumentException
      • CqlCommand
      • CqlConditionalCommand<TEntity>
      • CqlDelete
      • CqlFunction
      • CqlInsert<TEntity>
      • CqlLinqNotSupportedException
      • CqlOperator
      • CqlQuery<TEntity>
      • CqlQueryBase<TEntity>
      • CqlQueryExtensions
      • CqlQuerySingleElement<TEntity>
      • CqlScalar<TEntity>
      • CqlToken
      • CqlUpdate
      • IgnoreAttribute
      • ITable
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • SessionExtensions
      • StaticColumnAttribute
      • Table<TEntity>
      • TableAttribute
      • TableType
    • Cassandra.DataStax.Auth
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
    • Cassandra.DataStax.Auth.Sspi
      • SspiException
    • Cassandra.DataStax.Graph
      • Direction
      • Edge
      • Element
      • ElementMap
      • EnumWrapper
      • FluentGraphStatement
      • GraphNode
      • GraphOptions
      • GraphResultSet
      • GraphStatement
      • IEdge
      • IElement
      • IGraphNode
      • IGraphStatement
      • IPath
      • IProperty
      • IPropertyWithElement
      • IVertex
      • IVertexProperty
      • Path
      • SimpleGraphStatement
      • TEnum
      • Traverser
      • Vertex
    • Cassandra.DataStax.Graph.Internal
      • IGraphSONDeserializer
      • IGraphSONReader
      • IGraphSONSerializer
      • IGraphSONWriter
    • Cassandra.DataStax.Search
      • DateRange
      • DateRangeBound
      • DateRangePrecision
    • Cassandra.Geometry
      • GeometryBase
      • LineString
      • Point
      • Polygon
    • Cassandra.Mapping
      • AppliedInfo<T>
      • ColumnMap
      • Cql
      • CqlQueryOptions
      • IColumnDefinition
      • ICqlBatch
      • ICqlQueryAsyncClient
      • ICqlQueryClient
      • ICqlWriteAsyncClient
      • ICqlWriteClient
      • IMapper
      • IPage<T>
      • ITypeDefinition
      • Map<TPoco>
      • Mapper
      • MappingConfiguration
      • Mappings
      • PrimaryKeyAttribute
      • SortOrder
      • TableNameAttribute
    • Cassandra.Mapping.Attributes
      • ClusteringKeyAttribute
      • ColumnAttribute
      • CounterAttribute
      • FrozenAttribute
      • FrozenKeyAttribute
      • FrozenValueAttribute
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • StaticColumnAttribute
      • TableAttribute
    • Cassandra.Mapping.TypeConversion
      • DefaultTypeConverter
      • EnumStringMapper<T>
      • NullableEnumStringMapper<T>
      • TypeConverter
    • Cassandra.Mapping.Utils
      • MemberInfoExtensions
    • Cassandra.Metrics
      • DriverMetricsOptions
      • IDriverMetrics
      • IMetric
      • IMetricsRegistry<TMetric>
      • NodeMetric
      • NodeMetric.Counters
      • NodeMetric.Gauges
      • NodeMetric.Meters
      • NodeMetric.Timers
      • SessionMetric
      • SessionMetric.Counters
      • SessionMetric.Gauges
      • SessionMetric.Meters
      • SessionMetric.Timers
    • Cassandra.Metrics.Abstractions
      • IDriverCounter
      • IDriverGauge
      • IDriverMeter
      • IDriverMetric
      • IDriverMetricsProvider
      • IDriverTimer
    • Cassandra.Serialization
      • CustomTypeSerializer<T>
      • TypeSerializer
      • TypeSerializer<T>
      • TypeSerializerDefinitions
      • UdtSerializer
    • Cassandra.Serialization.Primitive
      • DecimalSerializer

    Class DCAwareRoundRobinPolicy

    A data-center aware Round-robin load balancing policy.

    This policy provides round-robin queries over the node of the local datacenter. Currently, it also includes in the query plans returned a configurable number of hosts in the remote datacenters (which are always tried after the local nodes) but this functionality will be removed in the next major version of the driver. See the comments on DCAwareRoundRobinPolicy(string, int) for more information.

    Inheritance
    object
    DCAwareRoundRobinPolicy
    Implements
    ILoadBalancingPolicy
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Cassandra
    Assembly: Cassandra.dll
    Syntax
    public class DCAwareRoundRobinPolicy : ILoadBalancingPolicy

    Constructors

    DCAwareRoundRobinPolicy()

    Creates a new datacenter aware round robin policy that auto-discover the local data-center.

    If this constructor is used, the data-center used as local will the data-center of the first Cassandra node the driver connects to. This will always be ok if all the contact points use at Cluster creation are in the local data-center. If it's not the case, you should provide the local data-center name yourself by using one of the other constructor of this class.

    Declaration
    public DCAwareRoundRobinPolicy()

    DCAwareRoundRobinPolicy(string, int)

    Creates a new DCAwareRoundRobin policy given the name of the local datacenter and that uses the provided number of host per remote datacenter as failover for the local hosts.

    The name of the local datacenter provided must be the local datacenter name as known by Cassandra.

    Declaration
    [Obsolete("The usedHostsPerRemoteDc parameter will be removed in the next major release of the driver. DC failover should not be done in the driver, which does not have the necessary context to know what makes sense considering application semantics. See https://datastax-oss.atlassian.net/browse/CSHARP-722")]
    public DCAwareRoundRobinPolicy(string localDc, int usedHostsPerRemoteDc)
    Parameters
    Type Name Description
    string localDc

    The name of the local datacenter (as known by Cassandra).

    int usedHostsPerRemoteDc

    The number of host per remote datacenter that policies created by the returned factory should consider. Created policies distance method will return a HostDistance.Remote distance for only usedHostsPerRemoteDc hosts per remote datacenter. Other hosts of the remote datacenters will be ignored (and thus no connections to them will be maintained).

    Note that this parameter will be removed in the next major release of the driver.

    DCAwareRoundRobinPolicy(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 Cassandra.

    The policy created will ignore all remote hosts. In other words, this is equivalent to new DCAwareRoundRobinPolicy(localDc, 0).

    Declaration
    public DCAwareRoundRobinPolicy(string localDc)
    Parameters
    Type Name Description
    string localDc

    the name of the local datacenter (as known by Cassandra).

    Properties

    LocalDc

    Gets the Local Datacenter. This value is provided in the constructor.

    Declaration
    public string LocalDc { get; }
    Property Value
    Type Description
    string

    UsedHostsPerRemoteDc

    Gets the number of hosts per remote datacenter that should be considered. This value is provided in the constructor.

    Declaration
    [Obsolete("The usedHostsPerRemoteDc parameter will be removed in the next major release of the driver. DC failover should not be done in the driver, which does not have the necessary context to know what makes sense considering application semantics. See https://datastax-oss.atlassian.net/browse/CSHARP-722")]
    public int UsedHostsPerRemoteDc { get; }
    Property Value
    Type Description
    int

    Methods

    Distance(Host)

    Return the HostDistance for the provided host.

    This policy consider nodes in the local datacenter as Local. For each remote datacenter, it considers a configurable number of hosts as Remote and the rest is Ignored.

    To configure how many host in each remote datacenter is considered Remote.

    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 host.

    Initialize(ICluster)

    Declaration
    public void Initialize(ICluster cluster)
    Parameters
    Type Name Description
    ICluster cluster

    NewQueryPlan(string, IStatement)

    Returns the hosts to use for a new query.

    The returned plan will always try each known host in the local datacenter first, and then, if none of the local host is reachable, will try up to a configurable number of other host per remote datacenter. The order of the local node in the returned query plan will follow a Round-robin algorithm.

    Declaration
    public IEnumerable<Host> NewQueryPlan(string keyspace, IStatement query)
    Parameters
    Type Name Description
    string keyspace

    Keyspace on which the query is going to be executed

    IStatement query

    the query for which to build the plan.

    Returns
    Type Description
    IEnumerable<Host>

    a new query plan, i.e. an iterator indicating which host to try first for querying, which one to use as failover, etc...

    Implements

    ILoadBalancingPolicy
    Back to top © DataStax, All rights reserved.