Click or drag to resize
Cassandra Namespace
The Cassandra namespace contains classes and interfaces to represent data types in the core driver.
Classes
  ClassDescription
Public classAggregateMetadata
Describes a CQL aggregate.
Public classAlreadyExistsException
Exception thrown when a query attemps to create a keyspace or table that already exists.
Public classAuthenticationException
Indicates an error during the authentication phase while connecting to a node.
Public classBatchStatement
A statement that groups a number of BoundStatement and / or SimpleStatement so they get executed as a batch.
Public classBigIntegerTypeAdapter
Public classBoundStatement
A prepared statement with values bound to the bind variables.

Once a BoundStatement has values for all the variables of the PreparedStatement it has been created from, it can executed (through Execute(IStatement)).

The values of a BoundStatement can be set by either index or name. When setting them by name, names follow the case insensitivity rules explained in ColumnDefinitions. Note-worthily, if multiple bind variables correspond to the same column (as would be the case if you prepare SELECT * FROM t WHERE x > ? AND x < ?), you will have to set values by indexes (or the PreparedStatement.Bind(object[]) method) as the methods to set by name only allows to set the first prepared occurrence of the column.

Public classBuilder
Helper class to build Cluster instances.
Public classCassandraConnectionStringBuilder
Public classClientOptions
Additional options of the .net Cassandra driver.
Public classCluster
Implementation of ICluster
Public classColumnDesc
Represents the information for a given data type
Public classConfiguration
The configuration of the cluster. This handle setting:
  • Cassandra binary protocol level configuration (compression).
  • Connection pooling configurations.
  • low-level tcp configuration options (tcpNoDelay, keepAlive, ...).
Public classConstantReconnectionPolicy
A reconnection policy that waits a constant time between each reconnection attempt.
Public classConstantSpeculativeExecutionPolicy
A ISpeculativeExecutionPolicy that schedules a given number of speculative executions, separated by a fixed delay.
Public classCqlColumn
Public classCustomColumnInfo
Public classDataCollectionMetadata
Describes a table or materialized view in Cassandra
Public classDCAwareRoundRobinPolicy
A data-center aware Round-robin load balancing policy.

This policy provides round-robin queries over the node of the local datacenter. It also includes in the query plans returned a configurable number of hosts in the remote datacenters, but those are always tried after the local nodes. In other words, this policy guarantees that no host in a remote datacenter will be queried unless no host in the local datacenter can be reached.

If used with a single datacenter, this policy is equivalent to the RoundRobinPolicy policy, but its GetDatacenter awareness incurs a slight overhead so the RoundRobinPolicy policy could be preferred to this policy in that case.

Public classDecimalTypeAdapter
Public classDefaultRetryPolicy
The default retry policy.

This policy retries queries in only two cases:

  • On a read timeout, if enough replica replied but data was not retrieved.
  • On a write timeout, if we timeout while writting the distributed log used by batch statements.

This retry policy is conservative in that it will never retry with a different consistency level than the one of the initial operation.

In some cases, it may be convenient to use a more aggressive retry policy like DowngradingConsistencyRetryPolicy.

Public classDiagnostics
Provides a set of methods and properties related to logging in the driver.
Public classDowngradingConsistencyRetryPolicy
A retry policy that sometimes retry with a lower consistency level than the one initially requested.

BEWARE: This policy may retry queries using a lower consistency level than the one initially requested. By doing so, it may break consistency guarantees. In other words, if you use this retry policy, there is cases (documented below) where a read at Quorum may not see a preceding write at Quorum. Do not use this policy unless you have understood the cases where this can happen and are OK with that. It is also highly recommended to always wrap this policy into LoggingRetryPolicy to log the occurrences of such consistency break.

This policy : the same retries than the DefaultRetryPolicy policy. But on top of that, it also retries in the following cases:

  • On a read timeout: if the number of replica that responded is greater than one but lower than is required by the requested consistency level, the operation is retried at a lower consistency level.
  • On a write timeout: if the operation is an WriteType.UNLOGGED_BATCH and at least one replica acknowledged the write, the operation is retried at a lower consistency level. Furthermore, for other operation, if at least one replica acknowledged the write, the timeout is ignored.
  • On an unavailable exception: if at least one replica is alive, the operation is retried at a lower consistency level.

The reasoning behind this retry policy is the following one. If, based on the information the Cassandra coordinator node returns, retrying the operation with the initially requested consistency has a change to succeed, do it. Otherwise, if based on these informations we know the initially requested consistency level cannot be achieve currently, then:

  • For writes, ignore the exception (thus silently failing the consistency requirement) if we know the write has been persisted on at least one replica.
  • For reads, try reading at a lower consistency level (thus silently failing the consistency requirement).
In other words, this policy : the idea that if the requested consistency level cannot be achieved, the next best thing for writes is to make sure the data is persisted, and that reading something is better than reading nothing, even if there is a risk of reading stale data.

Public classDriverException
Top level class for exceptions thrown by the driver.
Public classDriverInternalError
An unexpected error happened internally. This should never be raise and indicates an unexpected behavior (either in the driver or in Cassandra).
Public classDseAuthProvider
AuthProvider which supplies authenticator instances for clients to connect to DSE clusters secured with Kerberos. See KerberosAuthenticator for how to configure client side Kerberos options. To connect to clusters using internal authentication, use the standard method for setting credentials. eg:
 Cluster cluster = Cluster.builder()
             .addContactPoint(hostname) .withCredentials("username", "password") .build();
             
Public classDynamicCompositeTypeAdapter
Public classExecutionException
Public classExecutionInfo
Basic information on the execution of a query.

This provides the following information on the execution of a (successful) query:

  • The list of Cassandra hosts tried in order (usually just one, unless a node has been tried but was dead/in error or a timeout provoked a retry (which depends on the RetryPolicy)).
  • The consistency level achieved by the query (usually the one asked, though some specific RetryPolicy may allow this to be different).
  • The query trace recorded by Cassandra if tracing had been set for the query.
Public classExponentialReconnectionPolicy
A reconnection policy that waits exponentially longer between each reconnection attempt (but keeps a constant delay once a maximum delay is reached).
Public classFallthroughRetryPolicy
A retry policy that never retry (nor ignore).

All of the methods of this retry policy unconditionally return RetryPolicy.RetryDecision#rethrow. If this policy is used, retry will have to be implemented in business code.

Public classFixedReconnectionPolicy
Represents a reconnection policy that is possible to specify custom reconnection delays for each attempt.
Public classFunctionFailureException
Specifies a User defined function execution failure.
Public classFunctionMetadata
Describes a CQL function.
Public classHost
Represents a Cassandra node.
Public classHostsEventArgs
Public classIdempotenceAwareRetryPolicy
A retry policy that avoids retrying non-idempotent statements.

In case of write timeouts this policy will always return Rethrow if the statement is considered non-idempotent (see IsIdempotent). For all other cases, this policy delegates the decision to the child policy.

Public classIndexMetadata
A representation of a secondary index in Cassandra
Public classInvalidConfigurationInQueryException
A specific invalid query exception that indicates that the query is invalid because of some configuration problem.

This is generally throw by query that manipulate the schema (CREATE and ALTER) when the required configuration options are invalid.

Public classInvalidQueryException
Indicates a syntactically correct but invalid query.
Public classInvalidTypeException
Exception that is thrown when the driver expected a type and other was provided
Public classIsBootstrappingException
Public classKerberosAuthenticator
Responsible for authenticating with secured DSE services using Kerberos over SSPI
Public classKeyspaceMetadata
Public classListColumnInfo
Public classLocalDate
A date without a time-zone in the ISO-8601 calendar system. LocalDate is an immutable date-time object that represents a date, often viewed as year-month-day. This class is implemented to match the Date representation CQL string literals.
Public classLocalTime
A time without a time-zone in the ISO-8601 calendar system, such as 10:30:05. LocalTime is an immutable date-time object that represents a time, often viewed as hour-minute-second. Time is represented to nanosecond precision. For example, the value "13:45.30.123456789" can be stored in a LocalTime.
Public classLogger
Represents a driver Logger
Public classLoggingRetryPolicy
A retry policy that wraps another policy, logging the decision made by its sub-policy.

Note that this policy only log the Ignore and Retry decisions (since Rethrow decisions just amount to propate the cassandra exception). The logging is done at the Info level.

Public classMapColumnInfo
Public classMaterializedViewMetadata
Describes a materialized view in Cassandra.
Public classMetadata
Keeps metadata on the connected cluster, including known nodes and schema definitions.
Public classNoHostAvailableException
Exception thrown when a query cannot be performed because no host are available. This exception is thrown if
  • either there is no host live in the cluster at the moment of the query
  • all host that have been tried have failed due to a connection problem
For debugging purpose, the list of hosts that have been tried along with the failure cause can be retrieved using the #errors method.
Public classNoneAuthProvider
A provider that provides no authentication capability.

This is only useful as a placeholder when no authentication is to be used.

Public classNoSpeculativeExecutionPolicy
A ISpeculativeExecutionPolicy that never schedules speculative executions.
Public classNullTypeAdapter
Public classOperationTimedOutException
Exception that thrown on a client-side timeout, when the client didn't hear back from the server within ReadTimeoutMillis.
Public classOverloadedException
Public classPlainTextAuthProvider
A simple IAuthProvider implementation.

This provider allows to programmatically define authentication information that will then apply to all hosts. The PlainTextAuthenticator instances it returns support SASL authentication using the PLAIN mechanism for version 2 or above of the CQL native protocol.

Public classPolicies
Policies configured for a Cluster instance.
Public classPoolingOptions

Represents the options related to connection pooling.

For each host selected by the load balancing policy, the driver keeps a core amount of connections open at all times (GetCoreConnectionsPerHost(HostDistance)). If the use of those connections reaches a configurable threshold (GetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance)), more connections are created up to the configurable maximum number of connections (GetMaxConnectionPerHost(HostDistance)).

The driver uses connections in an asynchronous manner and multiple requests can be submitted on the same connection at the same time without waiting for a response. This means that the driver only needs to maintain a relatively small number of connections to each Cassandra host. The PoolingOptions allows you to to control how many connections are kept per host.

Each of these parameters can be separately set for Local and Remote hosts. For Ignored hosts, the default for all those settings is 0 and cannot be changed.

The default amount of connections depend on the Cassandra version of the Cluster, as newer versions of Cassandra (2.1 and above) support a higher number of in-flight requests.

For Cassandra 2.1 and above, the default amount of connections per host are:

  • Local datacenter: 1 core connection per host, with 2 connections as maximum if the simultaneous requests threshold is reached.
  • Remote datacenter: 1 core connection per host (being 1 also max).

For older Cassandra versions (1.2 and 2.0), the default amount of connections per host are:

  • Local datacenter: 2 core connection per host, with 8 connections as maximum if the simultaneous requests threshold is reached.
  • Remote datacenter: 1 core connection per host (being 2 the maximum).
Public classPreparedQueryNotFoundException
Public classPreparedStatement
Represents a prepared statement, a query with bound variables that has been prepared (pre-parsed) by the database.

A prepared statement can be executed once concrete values has been provided for the bound variables. The pair of a prepared statement and values for its bound variables is a BoundStatement and can be executed (by Session#Execute).

Public classProtocolErrorException
Public classProtocolOptions
Options of the Cassandra __native__ binary protocol.
Public classQueryExecutionException
Exception related to the execution of a query. This correspond to the exception that Cassandra throw when a (valid) query cannot be executed (TimeoutException, UnavailableException, ...).
Public classQueryOptions
Options related to defaults for individual queries.
Public classQueryProtocolOptions
Public classQueryTimeoutException
A Cassandra timeout during a query. Such an exception is returned when the query has been tried by Cassandra but cannot be achieved with the requested consistency level within the rpc timeout set for Cassandra.
Public classQueryTrace
The Cassandra trace for a query.

The trace is generated by Cassandra when query tracing is enabled for the query. The trace itself is stored in Cassandra in the sessions and events table in the system_traces keyspace and can be retrieve manually using the trace identifier (the one returned by TraceId).

Public classQueryTraceEvent
A trace event.

A query trace is composed of a list of trace events.

Public classQueryValidationException
An exception indicating that a query cannot be executed because it is incorrect syntactically, invalid, unauthorized or any other reason.
Public classReadFailureException
A Cassandra failure (non-timeout) during a read query.
Public classReadTimeoutException
A Cassandra timeout during a read query.
Public classRegularStatement
A non-prepared CQL statement. This class represents a query string along with query options. This class can be extended but SimpleStatement is provided to build a IStatement directly from its query string.
Public classReplicationStrategies
Provides utility methods to build replication strategies when creating a keyspace
Public classRequestInvalidException
Exception that indicates that the request is not valid.
Public classRetryDecision
A retry decision to adopt on a Cassandra exception (read/write timeout or unavailable exception).

There is three possible decision:

  • Rethrow: no retry should be attempted and an exception should be thrown
  • Retry: the operation will be retried. The consistency level of the retry should be specified.
  • Ignore: no retry should be attempted and the exception should be ignored. In that case, the operation that triggered the Cassandra exception will return an empty result set.

Public classRetryLoadBalancingPolicy
Public classRetryLoadBalancingPolicyEventArgs
Public classRoundRobinPolicy
A Round-robin load balancing policy.

This policy queries nodes in a round-robin fashion. For a given query, if an host fail, the next one (following the round-robin order) is tried, until all hosts have been tried.

This policy is not datacenter aware and will include every known Cassandra host in its round robin algorithm. If you use multiple datacenter this will be inefficient and you will want to use the DCAwareRoundRobinPolicy load balancing policy instead.

Public classRoutingKey
Routing key using to determine the node for each partition
Public classRow
Represents an CQL row
Public classRowSet
Represents a result of a query returned by Cassandra.

The retrieval of the rows of a RowSet is generally paged (a first page of result is fetched and the next one is only fetched once all the results of the first one has been consumed). The size of the pages can be configured either globally through SetPageSize(Int32) or per-statement with SetPageSize(Int32). Though new pages are automatically (and transparently) fetched when needed, it is possible to force the retrieval of the next page early through FetchMoreResults.

The RowSet dequeues Row items while iterated. Parallel enumerations is supported and thread-safe. After a full enumeration of this instance, following enumerations will be empty, as all rows have been dequeued.

Public classRowSetMetadata
Represents the information of columns and other state values associated with a RowSet
Public classSchemaChangedEventArgs
Public classServerErrorException
Public classSession
Implementation of ISession.
Public classSetColumnInfo
Public classSimpleDseCredentialsResolver
Public classSimpleStatement
A simple IStatement implementation built directly from a query string.
Public classSocketOptions
Options to configure low-level socket options for the connections kept to the Cassandra hosts.
Public classSSLOptions
Defines the SSL/TLS options to connect to a ssl enabled Cassandra host
Public classStatement
Base class for statements that contains the options.
Public classSyntaxError
Indicates a syntax error in a query.
Public classTableColumn
Represents a table column information
Public classTableMetadata
Describes a Cassandra table
Public classTableOptions
Public classTokenAwarePolicy
A wrapper load balancing policy that add token awareness to a child policy.

This policy encapsulates another policy. The resulting policy works in the following way:

Do note that only replica for which the child policy distance method returns HostDistance.Local will be considered having priority. For example, if you wrap DCAwareRoundRobinPolicy with this token aware policy, replicas from remote data centers may only be returned after all the host of the local data center.

Public classToManyConnectionsPerHost
Public classTraceRetrievalException
Exception thrown if a query trace cannot be retrieved.
Public classTruncateException
Error during a truncation operation.
Public classTupleColumnInfo
Represents the information associated with a tuple column.
Public classTypeAdapters
Public classUdtColumnInfo
Represents the type information associated with a User Defined Type
Public classUdtMap
Represents a map between a user defined type in Cassandra and a .NET Type, with data on how to map field names in the UDT to .NET property names.
Public classUdtMapT
Represents a map between a UDT in Cassandra and a .NET Type, including data on how to map from UDT field names to Properties on the .NET Type.
Public classUdtMappingDefinitions
Allows configuration of user defined types.
Public classUnauthorizedException
Indicates that a query cannot be performed due to the authorisation restrictions of the logged user.
Public classUnavailableException
Exception thrown when the coordinator knows there is not enough replica alive to perform a query with the requested consistency level.
Public classUnset
The Unset class represents a unspecified value.

In Cassandra 2.2 and above, when executing a UPDATE or INSERT query, a parameter can be unset. Designed to avoid tombstones, setting a parameter value to Unset will make Cassandra to ignore it.

Remarks
In some cases, we might be inserting rows using null for values that are not specified, and even though our intention is to leave the value empty, Cassandra will represent it as a tombstone causing an unnecessary overhead. To avoid tombstones, in previous versions of Cassandra, you can use different query combinations only containing the fields that have a value.

The Unset type is a singleton class, which means only one Unset object exists. The Unset.Value member represents the sole Unset object.

Public classWriteFailureException
A Cassandra failure (non-timeout) during a write query.
Public classWriteTimeoutException
A Cassandra timeout during a write query.
Structures
  StructureDescription
Public structureTimeUuid
Represents a v1 uuid
Interfaces
  InterfaceDescription
Public interfaceIAddressTranslator
Translates IP addresses received from Cassandra nodes into locally queriable addresses.
Public interfaceIAuthenticator
Handles SASL authentication with Cassandra servers. A server which requires authentication responds to a startup message with an challenge in the form of an AuthenticateMessage. Authenticator implementations should be able to respond to that challenge and perform whatever authentication negotiation is required by the server. The exact nature of that negotiation is specific to the configuration of the server.
Public interfaceIAuthProvider
Provides IAuthenticator instances for use when connecting to Cassandra nodes. See PlainTextAuthProvider for an implementation which uses SASL PLAIN mechanism to authenticate using username/password strings.
Public interfaceICluster
Informations 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 informations 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.

Public interfaceIColumnInfo
Specifies the type information associated with collections, maps, udts and other Cassandra types
Public interfaceIDseCredentialsResolver
Public interfaceIFrameCompressor
Defines the methods for frame compression and decompression
Public interfaceIInitializer
Initializer for Cluster instances.

If you want to create a new Cluster instance programmatically, then it is advised to use Cluster.Builder (obtained through the Cluster#builder method).

But it is also possible to implement a custom Initializer that retrieve initialization from a web-service or from a configuration file for instance.

Public interfaceILoadBalancingPolicy
The policy that decides which Cassandra hosts to contact for each new query. For efficiency purposes, the policy is expected to exclude down hosts from query plans.
Public interfaceIReconnectionPolicy
Policy that decides how often the reconnection to a dead node is attempted. Each time a node is detected dead (because a connection error occurs), a new IReconnectionSchedule instance is created (through the NewSchedule()). Then each call to the IReconnectionSchedule#NextDelayMs method of this instance will decide when the next reconnection attempt to this node will be tried. Note that if the driver receives a push notification from the Cassandra cluster that a node is UP, any existing IReconnectionSchedule on that node will be cancelled and a new one will be created (in effect, the driver reset the scheduler). The default ExponentialReconnectionPolicy policy is usually adequate.
Public interfaceIReconnectionSchedule
Schedules reconnection attempts to a node.
Public interfaceIRetryPolicy
A policy that defines a default behavior to adopt when a request returns a TimeoutException or an UnavailableException. Such policy allows to centralize the handling of query retries, allowing to minimize the need for exception catching/handling in business code.
Public interfaceISession
A session holds connections to a Cassandra cluster, allowing it to be queried.

Each session maintains multiple connections to the cluster nodes, provides policies to choose which node to use for each query (round-robin on all nodes of the cluster by default), and handles retries for failed query (when it makes sense), etc...

Session instances are thread-safe and usually a single instance is enough per application. However, a given session can only be set to one keyspace at a time, so one instance per keyspace is necessary.

Public interfaceISpeculativeExecutionPlan
Represents a plan that governs speculative executions for a given query.
Public interfaceISpeculativeExecutionPolicy
The policy that decides if the driver will send speculative queries to the next hosts when the current host takes too long to respond. only idempotent statements will be speculatively retried, see IsIdempotent for more information.
Public interfaceIStatement
An executable query. This represents either a SimpleStatement, a BoundStatement or a BoundStatement along with the query options (consistency level, whether to trace the query, ...).
Public interfaceITypeAdapter
Delegates
Enumerations
  EnumerationDescription
Public enumerationBatchType
The type of batch to use
Public enumerationColumnTypeCode
Specifies a Cassandra data type of a field
Public enumerationCompressionType
Compression supported by the Cassandra binary protocol.
Public enumerationConsistencyLevel
Consistency refers to how up-to-date and synchronized a row of Cassandra data is on all of its replicas. When selecting, the consistency level specifies how many replicas must respond to a read request before returning data to the client application. When updating, inserting or deleting the consistency level specifies the number of replicas on which the write must succeed before returning an acknowledgment to the client application.
Public enumerationDataCollectionMetadataSortOrder
Specifies sort order of the clustering keys
Public enumerationHostDistance
The distance to a Cassandra node as assigned by a ILoadBalancingPolicy relative to the ICluster instance.

The distance assigned to a host influences how many connections the driver maintains towards this host.

Public enumerationHostsEventArgsKind
Public enumerationIndexMetadataIndexKind
Describes the possible kinds of indexes
Public enumerationKeyType
Describes the type of key.

This enum is going to be deprecated in future releases, use PartitionKeys, ClusteringKeys and Indexes for a more accurate representation of a table or view keys and indexes.

Public enumerationQueryProtocolOptionsQueryFlags
Public enumerationRetryDecisionRetryDecisionType
The type of retry decisions.
Public enumerationSchemaChangedEventArgsKind