Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 216 additions & 16 deletions include/cassandra.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ typedef struct CassTableMeta_ CassTableMeta;
*/
typedef struct CassColumnMeta_ CassColumnMeta;

/**
* @struct CassIndexMeta
*
* Index metadata
*/
typedef struct CassIndexMeta_ CassIndexMeta;

/**
* @struct CassUuidGen
*
Expand Down Expand Up @@ -468,6 +475,21 @@ typedef enum CassWriteType_ {
XX(CASS_WRITE_TYPE_BATCH_LOG, "BATCH_LOG") \
XX(CASS_WRITE_TYPE_CAS, "CAS")

typedef enum CassColumnType_ {
CASS_COLUMN_TYPE_REGULAR,
CASS_COLUMN_TYPE_PARTITION_KEY,
CASS_COLUMN_TYPE_CLUSTERING_KEY,
CASS_COLUMN_TYPE_STATIC,
CASS_COLUMN_TYPE_COMPACT_VALUE
} CassColumnType;

typedef enum CassIndexType_ {
CASS_INDEX_TYPE_UNKNOWN,
CASS_INDEX_TYPE_KEYS,
CASS_INDEX_TYPE_CUSTOM,
CASS_INDEX_TYPE_COMPOSITES
} CassIndexType;

typedef enum CassValueType_ {
CASS_VALUE_TYPE_UNKNOWN = 0xFFFF,
CASS_VALUE_TYPE_CUSTOM = 0x0000,
Expand Down Expand Up @@ -503,14 +525,14 @@ typedef enum CassValueType_ {

typedef enum 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
CASS_COLLECTION_TYPE_MAP = CASS_VALUE_TYPE_MAP,
CASS_COLLECTION_TYPE_SET = CASS_VALUE_TYPE_SET
} CassCollectionType;

typedef enum CassBatchType_ {
CASS_BATCH_TYPE_LOGGED = 0,
CASS_BATCH_TYPE_UNLOGGED = 1,
CASS_BATCH_TYPE_COUNTER = 2
CASS_BATCH_TYPE_LOGGED = 0x00,
CASS_BATCH_TYPE_UNLOGGED = 0x01,
CASS_BATCH_TYPE_COUNTER = 0x02
} CassBatchType;

typedef enum CassIteratorType_ {
Expand All @@ -526,7 +548,8 @@ typedef enum CassIteratorType_ {
CASS_ITERATOR_TYPE_TYPE_META,
CASS_ITERATOR_TYPE_FUNCTION_META,
CASS_ITERATOR_TYPE_AGGREGATE_META,
CASS_ITERATOR_TYPE_COLUMN_META
CASS_ITERATOR_TYPE_COLUMN_META,
CASS_ITERATOR_TYPE_INDEX_META
} CassIteratorType;

#define CASS_LOG_LEVEL_MAP(XX) \
Expand All @@ -553,14 +576,6 @@ typedef enum CassSslVerifyFlags {
CASS_SSL_VERIFY_PEER_IDENTITY
} CassSslVerifyFlags;

typedef enum CassColumnType_ {
CASS_COLUMN_TYPE_REGULAR,
CASS_COLUMN_TYPE_PARTITION_KEY,
CASS_COLUMN_TYPE_CLUSTERING_KEY,
CASS_COLUMN_TYPE_STATIC,
CASS_COLUMN_TYPE_COMPACT_VALUE
} CassColumnType;

typedef enum CassErrorSource_ {
CASS_ERROR_SOURCE_NONE,
CASS_ERROR_SOURCE_LIB,
Expand Down Expand Up @@ -1862,6 +1877,38 @@ cass_table_meta_column_by_name_n(const CassTableMeta* table_meta,
const char* column,
size_t column_length);

/**
* Gets the index metadata for the provided index name.
*
* @public @memberof CassTableMeta
*
* @param[in] table_meta
* @param[in] index
*
* @return The metadata for a index. NULL if index does not exist.
*/
CASS_EXPORT const CassIndexMeta*
cass_table_meta_index_by_name(const CassTableMeta* table_meta,
const char* index);

/**
* Same as cass_table_meta_index_by_name(), but with lengths for string
* parameters.
*
* @public @memberof CassTableMeta
*
* @param[in] table_meta
* @param[in] index
* @param[in] index_length
* @return same as cass_table_meta_index_by_name()
*
* @see cass_table_meta_index_by_name()
*/
CASS_EXPORT const CassIndexMeta*
cass_table_meta_index_by_name_n(const CassTableMeta* table_meta,
const char* index,
size_t index_length);

/**
* Gets the name of the table.
*
Expand Down Expand Up @@ -1900,6 +1947,30 @@ CASS_EXPORT const CassColumnMeta*
cass_table_meta_column(const CassTableMeta* table_meta,
size_t index);

/**
* Gets the total number of indexes for the table.
*
* @public @memberof CassTableMeta
*
* @param[in] table_meta
* @return The total index count.
*/
CASS_EXPORT size_t
cass_table_meta_index_count(const CassTableMeta* table_meta);

/**
* Gets the index metadata for the provided index.
*
* @public @memberof CassTableMeta
*
* @param[in] table_meta
* @param[in] index
* @return The metadata for a index. NULL returned if the index is out of range.
*/
CASS_EXPORT const CassIndexMeta*
cass_table_meta_index(const CassTableMeta* table_meta,
size_t index);

/**
* Gets the number of columns for the table's partition key.
*
Expand Down Expand Up @@ -2049,6 +2120,88 @@ cass_column_meta_field_by_name_n(const CassColumnMeta* column_meta,
const char* name,
size_t name_length);

/**
* Gets the name of the index.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @param[out] name
* @param[out] name_length
*/
CASS_EXPORT void
cass_index_meta_name(const CassIndexMeta* index_meta,
const char** name,
size_t* name_length);

/**
* Gets the type of the index.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @return The index's type.
*/
CASS_EXPORT CassIndexType
cass_index_meta_type(const CassIndexMeta* index_meta);

/**
* Gets the target of the index.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @param[out] target
* @param[out] target_length
*/
CASS_EXPORT void
cass_index_meta_target(const CassIndexMeta* index_meta,
const char** target,
size_t* target_length);

/**
* Gets the options of the index.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @return The index's options.
*/
CASS_EXPORT const CassValue*
cass_index_meta_options(const CassIndexMeta* index_meta);

/**
* Gets a metadata field for the provided name. Metadata fields allow direct
* access to the index data found in the underlying "indexes" metadata table.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @param[in] name
* @return A metadata field value. NULL if the field does not exist.
*/
CASS_EXPORT const CassValue*
cass_index_meta_field_by_name(const CassIndexMeta* index_meta,
const char* name);

/**
* Same as cass_index_meta_field_by_name(), but with lengths for string
* parameters.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @param[in] name
* @param[in] name_length
* @return same as cass_index_meta_field_by_name()
*
* @see cass_index_meta_field_by_name()
*/
CASS_EXPORT const CassValue*
cass_index_meta_field_by_name_n(const CassIndexMeta* index_meta,
const char* name,
size_t name_length);

/**
* Gets the name of the function.
*
Expand Down Expand Up @@ -6611,6 +6764,21 @@ cass_iterator_fields_from_keyspace_meta(const CassKeyspaceMeta* keyspace_meta);
CASS_EXPORT CassIterator*
cass_iterator_columns_from_table_meta(const CassTableMeta* table_meta);

/**
* Creates a new iterator for the specified table metadata.
* This can be used to iterate over indexes.
*
* @public @memberof CassTableMeta
*
* @param[in] table_meta
* @return A new iterator that must be freed.
*
* @see cass_iterator_get_index_meta()
* @see cass_iterator_free()
*/
CASS_EXPORT CassIterator*
cass_iterator_indexes_from_table_meta(const CassTableMeta* table_meta);

/**
* Creates a new fields iterator for the specified table metadata. Metadata
* fields allow direct access to the column data found in the underlying
Expand Down Expand Up @@ -6647,13 +6815,31 @@ cass_iterator_fields_from_table_meta(const CassTableMeta* table_meta);
CASS_EXPORT CassIterator*
cass_iterator_fields_from_column_meta(const CassColumnMeta* column_meta);

/**
* Creates a new fields iterator for the specified index metadata. Metadata
* fields allow direct access to the index data found in the underlying
* "indexes" metadata table. This can be used to iterate those metadata
* field entries.
*
* @public @memberof CassIndexMeta
*
* @param[in] index_meta
* @return A new iterator that must be freed.
*
* @see cass_iterator_get_meta_field_name()
* @see cass_iterator_get_meta_field_value()
* @see cass_iterator_free()
*/
CASS_EXPORT CassIterator*
cass_iterator_fields_from_index_meta(const CassIndexMeta* index_meta);

/**
* Creates a new fields iterator for the specified function metadata. Metadata
* fields allow direct access to the column data found in the underlying
* "functions" metadata table. This can be used to iterate those metadata
* field entries.
*
* @public @memberof CassColumnMeta
* @public @memberof CassFunctionMeta
*
* @param[in] function_meta
* @return A new iterator that must be freed.
Expand All @@ -6670,7 +6856,7 @@ cass_iterator_fields_from_function_meta(const CassFunctionMeta* function_meta);
* "aggregates" metadata table. This can be used to iterate those metadata
* field entries.
*
* @public @memberof CassColumnMeta
* @public @memberof CassAggregateMeta
*
* @param[in] aggregate_meta
* @return A new iterator that must be freed.
Expand Down Expand Up @@ -6879,6 +7065,20 @@ cass_iterator_get_aggregate_meta(const CassIterator* iterator);
CASS_EXPORT const CassColumnMeta*
cass_iterator_get_column_meta(const CassIterator* iterator);

/**
* Gets the index metadata entry at the iterator's current position.
*
* Calling cass_iterator_next() will invalidate the previous
* value returned by this method.
*
* @public @memberof CassIterator
*
* @param[in] iterator
* @return A index metadata entry
*/
CASS_EXPORT const CassIndexMeta*
cass_iterator_get_index_meta(const CassIterator* iterator);

/**
* Gets the metadata field name at the iterator's current position.
*
Expand Down
Loading