file cassandra.h
C/C++ driver for Apache Cassandra. Uses the Cassandra Query Language versions 3 over the Cassandra Binary Protocol (versions 1 or 2).
Macros
CASS_VERSION_MAJOR
=2
CASS_VERSION_MINOR
=1
CASS_VERSION_PATCH
=0
CASS_VERSION_SUFFIX
=""
CASS_INET_V4_LENGTH
=4
The size of an IPv4 address
CASS_INET_V6_LENGTH
=16
The size of an IPv6 address
CASS_INET_STRING_LENGTH
=46
The size of an inet string including a null terminator.
CASS_UUID_STRING_LENGTH
=37
The size of a hexidecimal UUID string including a null terminator.
CASS_CONSISTENCY_MAP
=XX(CASS_CONSISTENCY_UNKNOWN, "UNKNOWN") \
XX(CASS_CONSISTENCY_ANY, "ANY") \
XX(CASS_CONSISTENCY_ONE, "ONE") \
XX(CASS_CONSISTENCY_TWO, "TWO") \
XX(CASS_CONSISTENCY_THREE, "THREE") \
XX(CASS_CONSISTENCY_QUORUM, "QUORUM") \
XX(CASS_CONSISTENCY_ALL, "ALL") \
XX(CASS_CONSISTENCY_LOCAL_QUORUM, "LOCAL_QUORUM") \
XX(CASS_CONSISTENCY_EACH_QUORUM, "EACH_QUORUM") \
XX(CASS_CONSISTENCY_SERIAL, "SERIAL") \
XX(CASS_CONSISTENCY_LOCAL_SERIAL, "LOCAL_SERIAL") \
XX(CASS_CONSISTENCY_LOCAL_ONE, "LOCAL_ONE")
CASS_WRITE_TYPE_MAP
=XX(CASS_WRITE_TYPE_SIMPLE, "SIMPLE") \
XX(CASS_WRITE_TYPE_BATCH, "BATCH") \
XX(CASS_WRITE_TYPE_UNLOGGED_BATCH, "UNLOGGED_BATCH") \
XX(CASS_WRITE_TYPE_COUNTER, "COUNTER") \
XX(CASS_WRITE_TYPE_BATCH_LOG, "BATCH_LOG") \
XX(CASS_WRITE_TYPE_CAS, "CAS")
CASS_LOG_MAX_MESSAGE_SIZE
=256
Maximum size of a log message
Types
cass_float_t
typedef float cass_float_t
cass_double_t
typedef double cass_double_t
cass_int8_t
typedef char cass_int8_t
cass_uint8_t
typedef unsigned char cass_uint8_t
cass_int16_t
typedef short cass_int16_t
cass_uint16_t
typedef unsigned short cass_uint16_t
cass_int32_t
typedef int cass_int32_t
cass_uint32_t
typedef unsigned int cass_uint32_t
cass_int64_t
typedef long long cass_int64_t
cass_uint64_t
typedef unsigned long long cass_uint64_t
cass_byte_t
typedef cass_uint8_t cass_byte_t
cass_duration_t
typedef cass_uint64_t cass_duration_t
CassCluster
typedef struct CassCluster_ CassCluster
CassSession
typedef struct CassSession_ CassSession
CassStatement
typedef struct CassStatement_ CassStatement
CassBatch
typedef struct CassBatch_ CassBatch
CassFuture
typedef struct CassFuture_ CassFuture
CassPrepared
typedef struct CassPrepared_ CassPrepared
CassResult
typedef struct CassResult_ CassResult
CassErrorResult
typedef struct CassErrorResult_ CassErrorResult
CassIterator
typedef struct CassIterator_ CassIterator
CassRow
typedef struct CassRow_ CassRow
CassValue
typedef struct CassValue_ CassValue
CassDataType
typedef struct CassDataType_ CassDataType
CassCollection
typedef struct CassCollection_ CassCollection
CassTuple
typedef struct CassTuple_ CassTuple
CassUserType
typedef struct CassUserType_ CassUserType
CassSsl
typedef struct CassSsl_ CassSsl
CassSchema
typedef struct CassSchema_ CassSchema
CassSchemaMeta
typedef struct CassSchemaMeta_ CassSchemaMeta
CassSchemaMetaField
typedef struct CassSchemaMetaField_ CassSchemaMetaField
CassUuidGen
typedef struct CassUuidGen_ CassUuidGen
CassTimestampGen
typedef struct CassTimestampGen_ CassTimestampGen
CassRetryPolicy
typedef struct CassRetryPolicy_ CassRetryPolicy
CassFutureCallback
typedef void(* CassFutureCallback) (CassFuture *future, void *data)
A callback that’s notified when the future is set.
- See Also:
CassLogCallback
typedef void(* CassLogCallback) (const CassLogMessage *message, void *data)
A callback that’s used to handle logging.
- See Also:
Enums
cass_bool_t
-
cass_false
= 0 -
cass_true
= 1
CassConsistency
-
CASS_CONSISTENCY_UNKNOWN
= 0xFFFF -
CASS_CONSISTENCY_ANY
= 0x0000 -
CASS_CONSISTENCY_ONE
= 0x0001 -
CASS_CONSISTENCY_TWO
= 0x0002 -
CASS_CONSISTENCY_THREE
= 0x0003 -
CASS_CONSISTENCY_QUORUM
= 0x0004 -
CASS_CONSISTENCY_ALL
= 0x0005 -
CASS_CONSISTENCY_LOCAL_QUORUM
= 0x0006 -
CASS_CONSISTENCY_EACH_QUORUM
= 0x0007 -
CASS_CONSISTENCY_SERIAL
= 0x0008 -
CASS_CONSISTENCY_LOCAL_SERIAL
= 0x0009 -
CASS_CONSISTENCY_LOCAL_ONE
= 0x000A
CassWriteType
CASS_WRITE_TYPE_UKNOWN
CASS_WRITE_TYPE_SIMPLE
CASS_WRITE_TYPE_BATCH
CASS_WRITE_TYPE_UNLOGGED_BATCH
CASS_WRITE_TYPE_COUNTER
CASS_WRITE_TYPE_BATCH_LOG
CASS_WRITE_TYPE_CAS
CassValueType
-
CASS_VALUE_TYPE_UNKNOWN
= 0xFFFF -
CASS_VALUE_TYPE_CUSTOM
= 0x0000 -
CASS_VALUE_TYPE_ASCII
= 0x0001 -
CASS_VALUE_TYPE_BIGINT
= 0x0002 -
CASS_VALUE_TYPE_BLOB
= 0x0003 -
CASS_VALUE_TYPE_BOOLEAN
= 0x0004 -
CASS_VALUE_TYPE_COUNTER
= 0x0005 -
CASS_VALUE_TYPE_DECIMAL
= 0x0006 -
CASS_VALUE_TYPE_DOUBLE
= 0x0007 -
CASS_VALUE_TYPE_FLOAT
= 0x0008 -
CASS_VALUE_TYPE_INT
= 0x0009 -
CASS_VALUE_TYPE_TEXT
= 0x000A -
CASS_VALUE_TYPE_TIMESTAMP
= 0x000B -
CASS_VALUE_TYPE_UUID
= 0x000C -
CASS_VALUE_TYPE_VARCHAR
= 0x000D -
CASS_VALUE_TYPE_VARINT
= 0x000E -
CASS_VALUE_TYPE_TIMEUUID
= 0x000F -
CASS_VALUE_TYPE_INET
= 0x0010 -
CASS_VALUE_TYPE_LIST
= 0x0020 -
CASS_VALUE_TYPE_MAP
= 0x0021 -
CASS_VALUE_TYPE_SET
= 0x0022 -
CASS_VALUE_TYPE_UDT
= 0x0030 -
CASS_VALUE_TYPE_TUPLE
= 0x0031
CassCollectionType
-
CASS_COLLECTION_TYPE_LIST
= CASS_VALUE_TYPE_LIST -
CASS_COLLECTION_TYPE_MAP
= CASS_VALUE_TYPE_MAP -
CASS_COLLECTION_TYPE_SET
= CASS_VALUE_TYPE_SET
CassBatchType
-
CASS_BATCH_TYPE_LOGGED
= 0 -
CASS_BATCH_TYPE_UNLOGGED
= 1 -
CASS_BATCH_TYPE_COUNTER
= 2
CassIteratorType
CASS_ITERATOR_TYPE_RESULT
CASS_ITERATOR_TYPE_ROW
CASS_ITERATOR_TYPE_COLLECTION
CASS_ITERATOR_TYPE_MAP
CASS_ITERATOR_TYPE_SCHEMA_META
CASS_ITERATOR_TYPE_SCHEMA_META_FIELD
CASS_ITERATOR_TYPE_TUPLE
CASS_ITERATOR_TYPE_USER_TYPE
CassSchemaMetaType
CASS_SCHEMA_META_TYPE_KEYSPACE
CASS_SCHEMA_META_TYPE_TABLE
CASS_SCHEMA_META_TYPE_COLUMN
CassLogLevel
CASS_LOG_DISABLED
CASS_LOG_CRITICAL
CASS_LOG_ERROR
CASS_LOG_WARN
CASS_LOG_INFO
CASS_LOG_DEBUG
CASS_LOG_TRACE
CassSslVerifyFlags
CASS_SSL_VERIFY_NONE
CASS_SSL_VERIFY_PEER_CERT
CASS_SSL_VERIFY_PEER_IDENTITY
CassErrorSource
CASS_ERROR_SOURCE_NONE
CASS_ERROR_SOURCE_LIB
CASS_ERROR_SOURCE_SERVER
CASS_ERROR_SOURCE_SSL
CASS_ERROR_SOURCE_COMPRESSION
CassError
-
CASS_OK
= 0 -
CASS_ERROR_LIB_BAD_PARAMS
= (( CASS_ERROR_SOURCE_LIB << 24) | 1 ) -
CASS_ERROR_LIB_NO_STREAMS
= (( CASS_ERROR_SOURCE_LIB << 24) | 2 ) -
CASS_ERROR_LIB_UNABLE_TO_INIT
= (( CASS_ERROR_SOURCE_LIB << 24) | 3 ) -
CASS_ERROR_LIB_MESSAGE_ENCODE
= (( CASS_ERROR_SOURCE_LIB << 24) | 4 ) -
CASS_ERROR_LIB_HOST_RESOLUTION
= (( CASS_ERROR_SOURCE_LIB << 24) | 5 ) -
CASS_ERROR_LIB_UNEXPECTED_RESPONSE
= (( CASS_ERROR_SOURCE_LIB << 24) | 6 ) -
CASS_ERROR_LIB_REQUEST_QUEUE_FULL
= (( CASS_ERROR_SOURCE_LIB << 24) | 7 ) -
CASS_ERROR_LIB_NO_AVAILABLE_IO_THREAD
= (( CASS_ERROR_SOURCE_LIB << 24) | 8 ) -
CASS_ERROR_LIB_WRITE_ERROR
= (( CASS_ERROR_SOURCE_LIB << 24) | 9 ) -
CASS_ERROR_LIB_NO_HOSTS_AVAILABLE
= (( CASS_ERROR_SOURCE_LIB << 24) | 10 ) -
CASS_ERROR_LIB_INDEX_OUT_OF_BOUNDS
= (( CASS_ERROR_SOURCE_LIB << 24) | 11 ) -
CASS_ERROR_LIB_INVALID_ITEM_COUNT
= (( CASS_ERROR_SOURCE_LIB << 24) | 12 ) -
CASS_ERROR_LIB_INVALID_VALUE_TYPE
= (( CASS_ERROR_SOURCE_LIB << 24) | 13 ) -
CASS_ERROR_LIB_REQUEST_TIMED_OUT
= (( CASS_ERROR_SOURCE_LIB << 24) | 14 ) -
CASS_ERROR_LIB_UNABLE_TO_SET_KEYSPACE
= (( CASS_ERROR_SOURCE_LIB << 24) | 15 ) -
CASS_ERROR_LIB_CALLBACK_ALREADY_SET
= (( CASS_ERROR_SOURCE_LIB << 24) | 16 ) -
CASS_ERROR_LIB_INVALID_STATEMENT_TYPE
= (( CASS_ERROR_SOURCE_LIB << 24) | 17 ) -
CASS_ERROR_LIB_NAME_DOES_NOT_EXIST
= (( CASS_ERROR_SOURCE_LIB << 24) | 18 ) -
CASS_ERROR_LIB_UNABLE_TO_DETERMINE_PROTOCOL
= (( CASS_ERROR_SOURCE_LIB << 24) | 19 ) -
CASS_ERROR_LIB_NULL_VALUE
= (( CASS_ERROR_SOURCE_LIB << 24) | 20 ) -
CASS_ERROR_LIB_NOT_IMPLEMENTED
= (( CASS_ERROR_SOURCE_LIB << 24) | 21 ) -
CASS_ERROR_LIB_UNABLE_TO_CONNECT
= (( CASS_ERROR_SOURCE_LIB << 24) | 22 ) -
CASS_ERROR_LIB_UNABLE_TO_CLOSE
= (( CASS_ERROR_SOURCE_LIB << 24) | 23 ) -
CASS_ERROR_LIB_NO_PAGING_STATE
= (( CASS_ERROR_SOURCE_LIB << 24) | 24 ) -
CASS_ERROR_SERVER_SERVER_ERROR
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x0000 ) -
CASS_ERROR_SERVER_PROTOCOL_ERROR
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x000A ) -
CASS_ERROR_SERVER_BAD_CREDENTIALS
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x0100 ) -
CASS_ERROR_SERVER_UNAVAILABLE
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x1000 ) -
CASS_ERROR_SERVER_OVERLOADED
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x1001 ) -
CASS_ERROR_SERVER_IS_BOOTSTRAPPING
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x1002 ) -
CASS_ERROR_SERVER_TRUNCATE_ERROR
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x1003 ) -
CASS_ERROR_SERVER_WRITE_TIMEOUT
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x1100 ) -
CASS_ERROR_SERVER_READ_TIMEOUT
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x1200 ) -
CASS_ERROR_SERVER_SYNTAX_ERROR
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x2000 ) -
CASS_ERROR_SERVER_UNAUTHORIZED
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x2100 ) -
CASS_ERROR_SERVER_INVALID_QUERY
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x2200 ) -
CASS_ERROR_SERVER_CONFIG_ERROR
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x2300 ) -
CASS_ERROR_SERVER_ALREADY_EXISTS
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x2400 ) -
CASS_ERROR_SERVER_UNPREPARED
= (( CASS_ERROR_SOURCE_SERVER << 24) | 0x2500 ) -
CASS_ERROR_SSL_INVALID_CERT
= (( CASS_ERROR_SOURCE_SSL << 24) | 1 ) -
CASS_ERROR_SSL_INVALID_PRIVATE_KEY
= (( CASS_ERROR_SOURCE_SSL << 24) | 2 ) -
CASS_ERROR_SSL_NO_PEER_CERT
= (( CASS_ERROR_SOURCE_SSL << 24) | 3 ) -
CASS_ERROR_SSL_INVALID_PEER_CERT
= (( CASS_ERROR_SOURCE_SSL << 24) | 4 ) -
CASS_ERROR_SSL_IDENTITY_MISMATCH
= (( CASS_ERROR_SOURCE_SSL << 24) | 5 ) -
CASS_ERROR_SSL_PROTOCOL_ERROR
= (( CASS_ERROR_SOURCE_SSL << 24) | 6 )
Functions
CassValueType
cass_data_type_type
( data_type )Gets the value type of the specified data type.
- Parameters:
Name Type Details in data_type - Returns:
Type Details CassValueType
The value type
CassError
cass_data_type_type_name
( data_type, type_name, type_name_length )Gets the type name of a UDT data type.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type out type_name out type_name_length - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_set_type_name
( data_type, type_name )Sets the type name of a UDT data type.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in type_name - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_keyspace
( data_type, keyspace, keyspace_length )Gets the type name of a UDT data type.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type out keyspace out keyspace_length - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_set_keyspace
( data_type, keyspace )Sets the keyspace of a UDT data type.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in keyspace - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_class_name
( data_type, class_name, class_name_length )Gets the class name of a custom data type.
Note: Only valid for custom data types.
- Parameters:
Name Type Details in data_type out class_name out class_name_length - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_set_class_name
( data_type, class_name )Sets the class name of a custom data type.
Note: Only valid for custom data types.
- Parameters:
Name Type Details in data_type in class_name - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
const CassDataType *
cass_data_type_sub_data_type
( data_type, index )Gets the sub-data type of a UDT (user defined type), tuple or collection at the specified index.
Note: Only valid for UDT, tuple and collection data types.
- Parameters:
Name Type Details in data_type in index - Returns:
Type Details const CassDataType *
Returns a reference to a child data type. Do not free this reference as it is bound to the lifetime of the parent data type. NULL is returned if the index is out of range.
const CassDataType *
cass_data_type_sub_data_type_by_name
( data_type, name )Gets the sub-data type of a UDT (user defined type) at the specified index.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in name - Returns:
Type Details const CassDataType *
Returns a reference to a child data type. Do not free this reference as it is bound to the lifetime of the parent data type. NULL is returned if the name doesn’t exist.
CassError
cass_data_type_sub_type_name
( data_type, index, name, name_length )Gets the sub-type name of a UDT (user defined type) at the specified index.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in index out name out name_length - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_add_sub_type
( data_type, sub_data_type )Adds a sub-data type to a tuple or collection.
Note: Only valid for tuple and collection data types.
- Parameters:
Name Type Details in data_type in sub_data_type - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_add_sub_type_by_name
( data_type, name, sub_data_type )Adds a sub-data type to a UDT (user defined type).
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in name in sub_data_type - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_add_sub_type_by_name_n
( data_type, name, name_length, sub_data_type )Same as cass_data_type_add_sub_type_by_name
, but with lengths for string parameters.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in name in name_length in sub_data_type - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_add_sub_value_type
( data_type, sub_value_type )Adds a sub-data type to a tuple or collection using a value type.
Note: Only valid for tuple and collection data types.
- Parameters:
Name Type Details in data_type in sub_value_type - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_add_sub_value_type_by_name
( data_type, name, sub_value_type )Adds a sub-data type to a UDT (user defined type) using a value type.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in name in sub_value_type - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
CassError
cass_data_type_add_sub_value_type_by_name_n
( data_type, name, name_length, sub_value_type )Same as cass_data_type_add_sub_value_type_by_name
, but with lengths for string parameters.
Note: Only valid for UDT data types.
- Parameters:
Name Type Details in data_type in name in name_length in sub_value_type - Returns:
Type Details CassError
CASS_OK if successful, otherwise an error occurred.
const CassDataType *
cass_collection_data_type
( collection )Gets the data type of a collection.
- Parameters:
Name Type Details in collection - Returns:
Type Details const CassDataType *
Returns a reference to the data type of the collection. Do not free this reference as it is bound to the lifetime of the collection.
const CassDataType *
cass_tuple_data_type
( tuple )Gets the data type of a tuple.
- Parameters:
Name Type Details in tuple - Returns:
Type Details const CassDataType *
Returns a reference to the data type of the tuple. Do not free this reference as it is bound to the lifetime of the tuple.
const CassDataType *
cass_user_type_data_type
( user_type )Gets the data type of a user defined type.
- Parameters:
Name Type Details in user_type - Returns:
Type Details const CassDataType *
Returns a reference to the data type of the user defined type. Do not free this reference as it is bound to the lifetime of the user defined type.
const char *
cass_consistency_string
( consistency )Gets the string for a consistency.
- Parameters:
Name Type Details in consistency - Returns:
Type Details const char *
A null-terminated string for the consistency. Example: "ALL", "ONE", "QUORUM", etc.
const char *
cass_write_type_string
( write_type )Gets the string for a write type.
- Parameters:
Name Type Details in write_type - Returns:
Type Details const char *
A null-terminated string for the write type. Example: "BATCH", "SIMPLE", "COUNTER", etc.
const char *
cass_error_desc
( error )Gets a description for an error code.
- Parameters:
Name Type Details in error - Returns:
Type Details const char *
A null-terminated string describing the error.
void
cass_log_cleanup
( )Explicitly wait for the log to flush and deallocate resources. This MUST be the last call using the library. It is an error to call any cass_*() functions after this call.
Deprecated:
This is no longer useful and does nothing. Expect this to be removed in a few releases.
void
cass_log_set_level
( log_level )Sets the log level.
Note: This needs to be done before any call that might log, such as any of the cass_cluster_*() or cass_ssl_*() functions.
Default: CASS_LOG_WARN
- Parameters:
Name Type Details in log_level
void
cass_log_set_callback
( callback, data )Sets a callback for handling logging events.
Note: This needs to be done before any call that might log, such as any of the cass_cluster_*() or cass_ssl_*() functions.
Default: An internal callback that prints to stderr
- Parameters:
Name Type Details in callback A callback that handles logging events. This is called in a separate thread so access to shared data must be synchronized.
in data An opaque data object passed to the callback.
void
cass_log_set_queue_size
( queue_size )Sets the log queue size.
Note: This needs to be done before any call that might log, such as any of the cass_cluster_*() or cass_ssl_*() functions.
Default: 2048
Deprecated:
This is no longer useful and does nothing. Expect this to be removed in a few releases.
- Parameters:
Name Type Details in queue_size
const char *
cass_log_level_string
( log_level )Gets the string for a log level.
- Parameters:
Name Type Details in log_level - Returns:
Type Details const char *
A null-terminated string for the log level. Example: "ERROR", "WARN", "INFO", etc.