• 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
      • CqlVector<T>
      • CustomColumnInfo
      • DCAwareRoundRobinPolicy
      • DataCollectionMetadata
      • DataCollectionMetadata.SortOrder
      • 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
      • IAuthProvider
      • IAuthenticator
      • ICluster
      • IColumnEncryptionPolicy
      • IColumnInfo
      • IExecutionProfile
      • IExecutionProfileBuilder
      • IExecutionProfileOptions
      • IExtendedRetryPolicy
      • IFrameCompressor
      • IInitializer
      • ILoadBalancingPolicy
      • IReconnectionPolicy
      • IReconnectionSchedule
      • IRequestTracker
      • IRetryPolicy
      • ISession
      • ISessionState
      • ISpeculativeExecutionPlan
      • ISpeculativeExecutionPolicy
      • IStatement
      • ITimestampGenerator
      • ITypeAdapter
      • IdempotenceAwareRetryPolicy
      • IndexMetadata
      • IndexMetadata.IndexKind
      • InitFatalErrorException
      • InvalidConfigurationInQueryException
      • InvalidQueryException
      • InvalidTypeException
      • IsBootstrappingException
      • KeyType
      • KeyspaceMetadata
      • ListColumnInfo
      • LocalDate
      • LocalTime
      • Logger
      • LoggingRetryPolicy
      • MapColumnInfo
      • MaterializedViewMetadata
      • Metadata
      • MetadataSyncOptions
      • MetricsExtensions
      • MonitorReportingOptions
      • NoHostAvailableException
      • NoSpeculativeExecutionPolicy
      • NodeRequestInfo
      • NoneAuthProvider
      • NullTypeAdapter
      • OperationTimedOutException
      • OverloadedException
      • PlainTextAuthProvider
      • Policies
      • PoolingOptions
      • PrepareRequest
      • 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
      • SSLOptions
      • SchemaChangedEventArgs
      • SchemaChangedEventArgs.Kind
      • SchemaChangedEventHandler
      • ServerErrorException
      • Session
      • SessionRequestInfo
      • SetColumnInfo
      • SimpleStatement
      • SocketOptions
      • Statement
      • SyntaxError
      • TableColumn
      • TableMetadata
      • TableOptions
      • TimeUuid
      • ToManyConnectionsPerHost
      • TokenAwarePolicy
      • TraceRetrievalException
      • TruncateException
      • TupleColumnInfo
      • TypeAdapters
      • UdtColumnInfo
      • UdtMap
      • UdtMap<T>
      • UdtMappingDefinitions
      • UnauthorizedException
      • UnavailableException
      • Unset
      • VectorColumnInfo
      • 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
      • CqlQueryBase<TEntity>
      • CqlQueryExtensions
      • CqlQuerySingleElement<TEntity>
      • CqlQuery<TEntity>
      • CqlScalar<TEntity>
      • CqlToken
      • CqlUpdate
      • ITable
      • IgnoreAttribute
      • PartitionKeyAttribute
      • SecondaryIndexAttribute
      • SessionExtensions
      • StaticColumnAttribute
      • TableAttribute
      • TableType
      • Table<TEntity>
    • 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.OpenTelemetry
      • BuilderExtensions
      • CassandraActivitySourceHelper
      • CassandraInstrumentationOptions
      • OpenTelemetryRequestTracker
    • Cassandra.Serialization
      • CustomTypeSerializer<T>
      • TypeSerializer
      • TypeSerializerDefinitions
      • TypeSerializer<T>
      • UdtSerializer
    • Cassandra.Serialization.Primitive
      • DecimalSerializer

    Interface ICluster

    Information and known state of a Cassandra cluster.

    This is the main entry point of the driver. A simple example of access to a Cassandra cluster would be:

    Cluster cluster = Cluster.Builder().AddContactPoint("192.168.0.1").Build(); 
    Session session = cluster.Connect("db1"); 
    foreach (var row in session.Execute("SELECT * FROM table1")) 
        // do something ...

    A cluster object maintains a permanent connection to one of the cluster node that it uses solely to maintain information on the state and current topology of the cluster. Using the connection, the driver will discover all the nodes composing the cluster as well as new nodes joining the cluster.

    Inherited Members
    IDisposable.Dispose()
    Namespace: Cassandra
    Assembly: Cassandra.dll
    Syntax
    public interface ICluster : IDisposable

    Properties

    Configuration

    Cluster client configuration

    Declaration
    Configuration Configuration { get; }
    Property Value
    Type Description
    Configuration

    Metadata

    Gets read-only metadata on the connected cluster.

    This includes the know nodes (with their status as seen by the driver) as well as the schema definitions.

    This method may trigger the creation of a connection if none has been established yet.

    Declaration
    Metadata Metadata { get; }
    Property Value
    Type Description
    Metadata

    Methods

    AllHosts()

    Returns all known hosts of this cluster.

    Declaration
    ICollection<Host> AllHosts()
    Returns
    Type Description
    ICollection<Host>

    Connect()

    Creates a new session on this cluster.

    Declaration
    ISession Connect()
    Returns
    Type Description
    ISession

    a new session on this cluster set to no keyspace.

    Connect(string)

    Creates a new session on this cluster and sets a keyspace to use.

    Declaration
    ISession Connect(string keyspace)
    Parameters
    Type Name Description
    string keyspace

    Case-sensitive keyspace name to use.

    Returns
    Type Description
    ISession

    a new session on this cluster set to keyspace: keyspaceName.

    ConnectAsync()

    Creates a new session on this cluster.

    Declaration
    Task<ISession> ConnectAsync()
    Returns
    Type Description
    Task<ISession>

    ConnectAsync(string)

    Creates a new session on this cluster and using a keyspace an existing keyspace.

    Declaration
    Task<ISession> ConnectAsync(string keyspace)
    Parameters
    Type Name Description
    string keyspace

    Case-sensitive keyspace name to use

    Returns
    Type Description
    Task<ISession>

    GetHost(IPEndPoint)

    Get the host instance for a given Ip address.

    Declaration
    Host GetHost(IPEndPoint address)
    Parameters
    Type Name Description
    IPEndPoint address

    Ip address of the host

    Returns
    Type Description
    Host

    The host or null if not found

    GetReplicas(byte[])

    Gets a collection of replicas for a given partitionKey. Backward-compatibility only, use GetReplicas(keyspace, partitionKey) instead.

    Declaration
    ICollection<Host> GetReplicas(byte[] partitionKey)
    Parameters
    Type Name Description
    byte[] partitionKey

    Byte array representing the partition key

    Returns
    Type Description
    ICollection<Host>

    GetReplicas(string, byte[])

    Gets a collection of replicas for a given partitionKey on a given keyspace

    Declaration
    ICollection<Host> GetReplicas(string keyspace, byte[] partitionKey)
    Parameters
    Type Name Description
    string keyspace

    Byte array representing the partition key

    byte[] partitionKey

    Byte array representing the partition key

    Returns
    Type Description
    ICollection<Host>

    RefreshSchema(string, string)

    Updates keyspace metadata (including token metadata for token aware routing) for a given keyspace or a specific keyspace table. If no keyspace is provided then this method will update the metadata and token map for all the keyspaces of the cluster.

    Declaration
    bool RefreshSchema(string keyspace = null, string table = null)
    Parameters
    Type Name Description
    string keyspace
    string table
    Returns
    Type Description
    bool

    RefreshSchemaAsync(string, string)

    Updates keyspace metadata (including token metadata for token aware routing) for a given keyspace or a specific keyspace table. If no keyspace is provided then this method will update the metadata and token map for all the keyspaces of the cluster.

    Declaration
    Task<bool> RefreshSchemaAsync(string keyspace = null, string table = null)
    Parameters
    Type Name Description
    string keyspace
    string table
    Returns
    Type Description
    Task<bool>

    Shutdown(int)

    Shutdown this cluster instance. This closes all connections from all the sessions of this * Cluster instance and reclaim all resources used by it.

    This method has no effect if the cluster was already shutdown.

    Declaration
    void Shutdown(int timeoutMs = -1)
    Parameters
    Type Name Description
    int timeoutMs

    ShutdownAsync(int)

    Shutdown this cluster instance asynchronously. This closes all connections from all the sessions of this * Cluster instance and reclaim all resources used by it.

    This method has no effect if the cluster was already shutdown.

    Declaration
    Task ShutdownAsync(int timeoutMs = -1)
    Parameters
    Type Name Description
    int timeoutMs
    Returns
    Type Description
    Task

    Events

    HostAdded

    Event that gets triggered when a new host is added to the cluster

    Declaration
    event Action<Host> HostAdded
    Event Type
    Type Description
    Action<Host>

    HostRemoved

    Event that gets triggered when a host has been removed from the cluster

    Declaration
    event Action<Host> HostRemoved
    Event Type
    Type Description
    Action<Host>
    Back to top © DataStax, All rights reserved.