libQtCassandra: QtCassandra::QCassandraTable Class Reference

libQtCassandra 1.0

Defines a table and may hold a Cassandra column family definition. More...

#include <QCassandraTable.h>

Inheritance diagram for QtCassandra::QCassandraTable:
Collaboration diagram for QtCassandra::QCassandraTable:

List of all members.

Public Member Functions

 ~QCassandraTable ()
 Clean up the QCassandraTable object.

void clearCache ()
 Clear the memory cache.

QSharedPointer
< QCassandraColumnDefinition
columnDefinition (const QString &column_name)
 Retrieve a column definition by name.

const QCassandraColumnDefinitionscolumnDefinitions () const
 Return the a reference to the column definitions.

QString columnType () const
 Retrieve the current column type.

QString comment () const
 Retrieve the table comment.

QString comparatorType () const
 Retrieve the comparator type for this table name.

QCassandraContextcontext () const
 Return the context attached to this table definition.

QString contextName () const
 Return the name of the context attached to this table definition.

void create ()
 Create a Cassandra table.

QString defaultValidationClass () const
 Retrieve the default validation class.

void dropRow (const QByteArray &row_key, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0, consistency_level_t consistency_level=CONSISTENCY_LEVEL_ALL)
 Drop the row from the Cassandra database.

void dropRow (const QString &row_name, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0, consistency_level_t consistency_level=CONSISTENCY_LEVEL_ALL)
 Drop the named row.

bool exists (const QString &row_name) const
 Check whether a row exists.

bool exists (const QByteArray &row_key) const
 Check whether a row exists.

QSharedPointer< QCassandraRowfindRow (const QString &row_name) const
 Search for a row.

QSharedPointer< QCassandraRowfindRow (const QByteArray &row_key) const
 Search for a row.

int32_t gcGraceSeconds () const
 Get the current garbage collect grace period.

int32_t identifier () const
 Retrieve the table definition identifier.

QString keyAlias () const
 Retrieve the key alias for this table.

int32_t keyCacheSavePeriodInSeconds () const
 Retrieve the key cache save period.

double keyCacheSize () const
 Get the size of the key cache.

QString keyValidationClass () const
 Retrieve the current validation class for the table name.

double maxCompactionThreshold () const
 Retrieve the current maximum compaction threshold.

int32_t memtableFlushAfterMins () const
 Retrieve the memory table flush period.

int32_t memtableOperationsInMillions () const
 Retrieve the current number of operations before flushing memory tables.

int32_t memtableThroughputInMb () const
 Get the memtable throughput.

double mergeShardsChance () const
 Return the current merge shards chance value.

double minCompactionThreshold () const
 Retrieve the current minimum compaction threshold.

QCassandraRowoperator[] (const QString &row_name)
 Retrieve a table row.

QCassandraRowoperator[] (const QByteArray &row_key)
 Retrieve a table row.

const QCassandraRowoperator[] (const QByteArray &row_key) const
 Retrieve a table row.

const QCassandraRowoperator[] (const QString &row_name) const
 Retrieve a table row.

double readRepairChance () const
 Retrieve the current value of the read repair chance.

uint32_t readRows (const QCassandraRowPredicate &row_predicate=QCassandraRowPredicate())
 Read a set of rows as defined by the row predicate.

bool replicateOnWrite () const
 Retrieve the current status of the replicate on write flag.

QSharedPointer< QCassandraRowrow (const QString &row_name)
 Search for a row or create a new one.

QSharedPointer< QCassandraRowrow (const QByteArray &row_key)
 Search for a row or create a new one.

QString rowCacheProvider () const
 Retrieve the row cache provider.

int32_t rowCacheSavePeriodInSeconds () const
 Retreive the row cache save period.

double rowCacheSize () const
 Retrieve the current row cache size.

const QCassandraRowsrows () const
 Retrieve the entire set of rows defined in this table.

void setColumnType (const QString &column_type)
 Set the column type on this table.

void setComment (QString comment)
 Set the table comment.

void setComparatorType (const QString &comparator_type)
 Define the column comparator type.

void setDefaultValidationClass (const QString &validation_class)
 Set the default validation class.

void setGcGraceSeconds (int32_t seconds)
 Defines the number of seconds to wait before forced garbage collection.

void setIdentifier (int32_t identifier)
 Define the table identifier.

void setKeyAlias (const QString &key_alias)
 Set the alias for the key.

void setKeyCacheSavePeriodInSeconds (int32_t seconds)
 Define the amount of time the key cache is kept in memory.

void setKeyCacheSize (double size)
 Define the size of the cache key.

void setKeyValidationClass (const QString &validation_class)
 Set the table name validation class.

void setMaxCompactionThreshold (int32_t threshold)
 Set the maximum compaction threshold.

void setMemtableFlushAfterMins (int32_t minutes)
 Set the table flashing period.

void setMemtableOperationsInMillions (int32_t operations)
 Operations limit flush.

void setMemtableThroughputInMb (int32_t megabytes)
 Set the memtable throughput.

void setMergeShardsChance (double merge_shards_chance)
 Set the amount of chance that counters get merged.

void setMinCompactionThreshold (int32_t threshold)
 Set the minimum compaction threshold.

void setReadRepairChance (double repair_chance)
 Set the read repair change value.

void setReplicateOnWrite (bool replicate_on_write)
 Set whether replication occurs on write.

void setRowCacheProvider (const QString &provider)
 Set the row cache provider class name.

void setRowCacheSavePeriodInSeconds (int32_t seconds)
 Set the cache save period for rows.

void setRowCacheSize (double size)
 Define the number of rows of this type to cache.

void setSubcomparatorType (const QString &subcomparator_type)
 Set the sub-comparator type.

QString subcomparatorType () const
 Return the current sub-comparator type.

QString tableName () const
 Retrieve the name of this table.

void truncate ()
 Truncate a Cassandra table.

void unsetColumnType ()
 Unset the column type on this table.

void unsetComment ()
 Unset a comment.

void unsetComparatorType ()
 Cancel calls to the setComparatorType() function.

void unsetDefaultValidationClass ()
 Unset the default validation class.

void unsetGcGraceSeconds ()
 Unset the garbage collection grace period value.

void unsetIdentifier ()
 Unset the table definition identifier.

void unsetKeyAlias ()
 Unset the alias for the key.

void unsetKeyCacheSavePeriodInSeconds ()
 Unset the effect of calling setKeyCacheSavePeriodInSeconds().

void unsetKeyCacheSize ()
 Unset the key cache size.

void unsetKeyValidationClass ()
 Unset the table name validation class.

void unsetMaxCompactionThreshold ()
 Mark the maximum compaction as unset.

void unsetMemtableFlushAfterMins ()
 Unset the memtable flush period parameter.

void unsetMemtableOperationsInMillions ()
 Unset the operations limit parameter.

void unsetMemtableThroughputInMb ()
 Unset the memtable throughput value.

void unsetMergeShardsChance ()
 Unset the merge shards value.

void unsetMinCompactionThreshold ()
 Mark the minimum compaction as unset.

void unsetReadRepairChance ()
 Unset the read repair chance.

void unsetReplicateOnWrite ()
 Unset the replicate on write flag.

void unsetRowCacheProvider ()
 Mark the cache provider class name as unset.

void unsetRowCacheSavePeriodInSeconds ()
 Mark the row cache save period as unset.

void unsetRowCacheSize ()
 Unset the row cache size.

void unsetSubcomparatorType ()
 Unset the sub-comparator type specification.

void update ()
 Update a Cassandra table.

Private Member Functions

 QCassandraTable (QCassandraContext *context, const QString &table_name)
 Initialize a QCassandraTable object.

void assignRow (const QByteArray &row_key, const QByteArray &column_key, const QCassandraValue &value)
 Assign a value to a cell in a row of this table.

int32_t getCellCount (const QByteArray &row_key, const QCassandraColumnPredicate &column_predicate)
 Count columns.

void getColumnSlice (const QByteArray &row_key, const QCassandraColumnPredicate &column_predicate)
 Read a slice of columns.

void getValue (const QByteArray &row_key, const QByteArray &column_key, QCassandraValue &value)
 Get a cell value from Cassandra.

void insertValue (const QByteArray &row_key, const QByteArray &column_key, const QCassandraValue &value)
 Save a cell value that changed.

void parseTableDefinition (const void *data)
 This is an internal function used to parse a CfDef structure.

void prepareTableDefinition (void *data) const
 Prepare a table definition.

void remove (const QByteArray &row_key, const QByteArray &column_key, int64_t timestamp, consistency_level_t consistency_level)
 Delete a Cell from a table row.

void setFromCassandra ()
 Mark this table as from Cassandra.

Private Attributes

QCassandraColumnDefinitions f_column_definitions
 Set of column definitions.

QCassandraContextf_context
 The context that created this table.

controlled_vars::zbool_t f_from_cassandra
 Whether the table is a memory table or a server table.

std::auto_ptr
< QCassandraTablePrivate
f_private
 The table private data: CfDef.

QCassandraRows f_rows
 Set of rows.

Friends

class QCassandraContext
class QCassandraPrivate
class QCassandraRow
class QCassandraTablePrivate

Detailed Description

In Cassandra, a table is called a column family. Mainly because each row in a Cassandra table can have a different set of columns whereas a table is usually viewed as a set of rows that all have the exact same number of columns (but really, even in SQL the set of columns can be viewed as varying since columns can be set to NULL and that has [nearly] the same effect as not defining a column in Cassandra.)

This class defines objects that can hold all the column family information so as to create new ones and read existing ones.

The name of a table is very limited (i.e. letters, digits, and underscores, and the name must start with a letter.) The maximum length is not specified, but it is relatively short as it is used as a filename that will hold the data of the table.

Whenever trying to get a row, the default behavior is to create a new row if it doesn't exist yet. If you need to know whether a row exists, make sure you use the exists() function.

See also:
exists()

Definition at line 54 of file QCassandraTable.h.


Constructor & Destructor Documentation

QtCassandra::QCassandraTable::~QCassandraTable ( )

This function ensures that all resources allocated by the QCassandraTable are released.

Definition at line 189 of file QCassandraTable.cpp.

QtCassandra::QCassandraTable::QCassandraTable ( QCassandraContext context,
const QString &  table_name 
) [private]

This function initializes a QCassandraTable object.

All the parameters are set to the defaults as defined in the Cassandra definition of the CfDef message. You can use the different functions to change the default values.

Note that the context and table name cannot be changed later. These are fixed values that follow the Cassandra behavior.

A table name must be composed of letters (A-Za-z), digits (0-9) and underscores (_). It must start with a letter. The corresponding lexical expression is: /^[A-Za-z][A-Za-z0-9_]*$\/

Parameters:
[in]contextThe context where this table definition is created.
[in]table_nameThe name of the table definition being created.

Definition at line 162 of file QCassandraTable.cpp.

References QtCassandra::QCassandraContext::contextName(), and f_private.


Member Function Documentation

void QtCassandra::QCassandraTable::assignRow ( const QByteArray &  row_key,
const QByteArray &  column_key,
const QCassandraValue value 
) [private]

This function assigns the specified value to a cell in a row of this table. It is an internal function used to save the results of a get_slice() function call.

It also marks the data as coming from Cassandra so it remains cached as expected (i.e. we avoid further reads until the cache gets cleared.)

Parameters:
[in]row_keyThe binary key of the row.
[in]column_keyThe binary key of the cell.
[in]valueThe value to assign to the named cell.

Definition at line 1938 of file QCassandraTable.cpp.

References row().

Referenced by QtCassandra::QCassandraPrivate::getColumnSlice(), and QtCassandra::QCassandraPrivate::getRowSlices().

void QtCassandra::QCassandraTable::clearCache ( )

This function clears the memory cache. This means all the rows and their cells will be deleted from this table. The memory cache doesn't affect the Cassandra database.

After a clear, you can retrieve fresh data (i.e. by directly loading the data from the Cassandra database.)

Definition at line 1486 of file QCassandraTable.cpp.

References f_rows.

Referenced by truncate().

QSharedPointer< QCassandraColumnDefinition > QtCassandra::QCassandraTable::columnDefinition ( const QString &  column_name)

This function is used to retrieve a column definition by name. If the column doesn't exist, it gets created.

You can test whether the result is null with the isNull() function of the QSharedPointer class.

Parameters:
[in]column_nameThe name of the column definition to retrieve.
Returns:
A shared pointer to the table found or a null shared pointer.

Definition at line 592 of file QCassandraTable.cpp.

References f_column_definitions.

Referenced by parseTableDefinition().

const QCassandraColumnDefinitions & QtCassandra::QCassandraTable::columnDefinitions ( ) const

This function gives you direct access to the internal map of column definitions to avoid a copy of the map. Note that if you change the definitions in any way, this map may become invalid. To be safe, it is wise to make a copy.

The map is indexed by column names.

Returns:
A reference to the internal map of column definitions.

Definition at line 617 of file QCassandraTable.cpp.

References f_column_definitions.

QString QtCassandra::QCassandraTable::columnType ( ) const

This function returns the current column type of this table definition.

Returns:
The named type of the table definition column.

Definition at line 344 of file QCassandraTable.cpp.

References f_private.

QString QtCassandra::QCassandraTable::comment ( ) const

This function retrieves the comment assigned to this table.

Returns:
A string with the table definition comment.
See also:
unsetComment()
setComment()

Definition at line 305 of file QCassandraTable.cpp.

References f_private.

QString QtCassandra::QCassandraTable::comparatorType ( ) const

This function returns a copy of the comparator type.

Returns:
The comparator type.

Definition at line 536 of file QCassandraTable.cpp.

References f_private.

QCassandraContext * QtCassandra::QCassandraTable::context ( ) const

This function returns the bare pointer of the context attached to this definition. The context can be used as long as the table definition remains in place.

Note that you cannot change the context attached to a table definition. To "move" a table from one context to another is not a trivial thing to do in Cassandra so we do not offer such a feature here.

Returns:
A bare pointer to the context in which this table definition is found.

Definition at line 205 of file QCassandraTable.cpp.

References f_context.

QString QtCassandra::QCassandraTable::contextName ( ) const

This function returns the name of the context attached to this table definition.

Note that it is not possible to rename a context and therefore this name will never change.

Returns:
The name of the context this table definition is defined in.

Definition at line 220 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::create ( )

This function creates a Cassandra table in the context as specified when you created the QCassandraTable object.

If you want to declare a set of columns, this is a good time to do it too (there is not QColumnDefinition::create() function!) By default, columns use the default validation type as defined using the setComparatorType() for their name and the setDefaultValidationClass() for their data. It is not required to define any column. In that case they all make use of the exact same data.

The table cannot already exist or an error will be thrown by the Cassandra server. If the table is being updated, use the update() function instead.

Note that when you create a new context, you can create its tables at once by defining tables before calling the QCassandraContext::create() function.

Creating a new QCassandraTable:

 QSharedPointer<QtCassandra::QCassandraTable> table(context->table("qt_cassandra_test_table"));
 table->setComment("Our test table.");
 table->setColumnType("Standard"); // Standard or Super
 table->setKeyValidationClass("BytesType");
 table->setDefaultValidationClass("BytesType");
 table->setComparatorType("BytesType");
 table->setKeyCacheSavePeriodInSeconds(14400);
 table->setMemtableFlushAfterMins(60);
 // Memtable defaults are dynamic and usually a better bet
 //table->setMemtableThroughputInMb(247);
 //table->setMemtableOperationsInMillions(1.1578125);
 table->setGcGraceSeconds(864000);
 table->setMinCompactionThreshold(4);
 table->setMaxCompactionThreshold(22);
 table->setReplicateOnWrite(1);
 table->create();
See also:
QCassandraContext::create()
update()

Definition at line 1441 of file QCassandraTable.cpp.

References QtCassandra::QCassandraContext::createTable(), f_context, and f_from_cassandra.

QString QtCassandra::QCassandraTable::defaultValidationClass ( ) const

This function retrieves the default validation class for the columns of this table.

Returns:
The validation class name.

Definition at line 384 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::dropRow ( const QByteArray &  row_key,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0,
consistency_level_t  consistency_level = CONSISTENCY_LEVEL_ALL 
)

This function deletes the specified row and its data from the Cassandra database and from memory.

In regard to getting the row deleted from memory, you are expected to use a weak pointer as follow:

 ...
 {
     QWeakPointer<QtCassandra::QCassandraRow> row(table.row(row_key)));
     table.dropRow(row);
 }
 ...

Note that Cassandra doesn't actually remove the row from its database until the next time it does a garbage collection. Still, if there is a row you do not need, drop it.

The timestamp mode can be set to QCassandraValue::TIMESTAMP_MODE_DEFINED in which case the value defined in the timestamp parameter is used by the Cassandra remove() function.

By default the mode parameter is set to QCassandraValue::TIMESTAMP_MODE_AUTO which means that we'll make use of the current time (i.e. only a row created after this call will exist.)

The consistency level is set to CONSISTENCY_LEVEL_ALL since you are likely willing to delete the row on all the nodes. However, I'm not certain this is the best choice here. So the default may change in the future. You may specify CONSISTENCY_LEVEL_DEFAULT in which case the QCassandra object default is used.

Warning:
Remember that a row doesn't actually get removed from the Cassandra database until the next Garbage Collection runs. This is important for all your data centers to be properly refreshed. This also means a readRows() will continue to return the deleted row unless you check for a specific column that has to exist. In that case, the row is not returned since all the columns ARE deleted (or at least hidden in some way.) This function could be called truncate(), however, all empty rows are really removed at some point.
After a row was dropped, you cannot use the row object anymore, even if you kept a shared pointer to it. Calling functions of a dropped row is likely to get you a run-time exception. Note that all the cells defined in the row are also dropped and are also likely to generate a run-time exception if you kept a shared pointer on any one of them.
Parameters:
[in]row_keySpecify the key of the row.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only rows that are have that timestamp or are older.
[in]consistency_levelSpecify the timestamp to remove only rows that are have that timestamp or are older.

Definition at line 1858 of file QCassandraTable.cpp.

References f_rows, QtCassandra::QCassandra::timeofday(), QtCassandra::QCassandraValue::TIMESTAMP_MODE_AUTO, and QtCassandra::QCassandraValue::TIMESTAMP_MODE_DEFINED.

Referenced by dropRow().

void QtCassandra::QCassandraTable::dropRow ( const QString &  row_name,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0,
consistency_level_t  consistency_level = CONSISTENCY_LEVEL_ALL 
)

This function is the same as the dropRow() that takes a row_key parameter. It simply transforms the row name into a row key and calls that other function.

Parameters:
[in]row_nameSpecify the name of the row to drop.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only rows that are have that timestamp or are older.
[in]consistency_levelSpecify the timestamp to remove only rows that are have that timestamp or are older.

Definition at line 1888 of file QCassandraTable.cpp.

References dropRow().

bool QtCassandra::QCassandraTable::exists ( const QByteArray &  row_key) const

This function checks whether a row exists. First it checks whether it exists in memory. If not, then it checks in the Cassandra database.

Parameters:
[in]row_keyThe binary key of the row to check for.
Returns:
true if the row exists in memory or in Cassandra.

Definition at line 1681 of file QCassandraTable.cpp.

References f_rows, readRows(), QtCassandra::QCassandraRowPredicate::setColumnPredicate(), QtCassandra::QCassandraRowPredicate::setEndRowKey(), QtCassandra::setInt32Value(), and QtCassandra::QCassandraRowPredicate::setStartRowKey().

bool QtCassandra::QCassandraTable::exists ( const QString &  row_name) const

This function checks whether the named row exists.

Parameters:
[in]row_nameThe row name in to transform to UTF-8.
Returns:
true if the row exists in memory or the Cassandra database.

Definition at line 1667 of file QCassandraTable.cpp.

QSharedPointer< QCassandraRow > QtCassandra::QCassandraTable::findRow ( const QString &  row_name) const

This function searches for a row. If it doesn't exist, then a NULL pointer is returned (use the .isNull() function on the shared pointer.)

The function can be used to check whether a given row was already created in memory without actually creating it.

This function accepts a row name which is a UTF-8 string.

Parameters:
[in]row_nameThe name of the row to check for.
Returns:
A shared pointer to the row, may be NULL (isNull() returning true)
See also:
row()

Definition at line 1623 of file QCassandraTable.cpp.

References f_rows.

Referenced by operator[]().

QSharedPointer< QCassandraRow > QtCassandra::QCassandraTable::findRow ( const QByteArray &  row_key) const

This function searches for a row. If it doesn't exist, then a NULL pointer is returned (use the .isNull() function on the shared pointer.)

The function can be used to check whether a given row was already created in memory without actually creating it.

This function accepts a row key which is a binary buffer.

Parameters:
[in]row_keyThe binary key of the row to search for.
Returns:
A shared pointer to the row, may be NULL (isNull() returning true)
See also:
row()

Definition at line 1649 of file QCassandraTable.cpp.

References f_rows.

int32_t QtCassandra::QCassandraTable::gcGraceSeconds ( ) const

This value is used by the Cassandra system to force garbage collection tombstones removals.

Returns:
The number of seconds to wait before each garbage collection recollections.

Definition at line 1026 of file QCassandraTable.cpp.

References f_private.

int32_t QtCassandra::QCassandraTable::getCellCount ( const QByteArray &  row_key,
const QCassandraColumnPredicate column_predicate 
) [private]

This function counts a the number of columns that match a specified column_predicate.

Parameters:
[in]row_keyThe row for which this data is being counted.
[in]column_predicateThe predicate to use to count the cells.
Returns:
The number of columns in this row.

Definition at line 1955 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, f_rows, QtCassandra::QCassandraContext::getCellCount(), and tableName().

Referenced by QtCassandra::QCassandraRow::cellCount().

void QtCassandra::QCassandraTable::getColumnSlice ( const QByteArray &  row_key,
const QCassandraColumnPredicate column_predicate 
) [private]

This function reads a slice of columns as specified in the column_predicate.

Parameters:
[in]row_keyThe row for which this data is being read.
[in]column_predicateThe predicate to use to read the cells.

Definition at line 1972 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, and QtCassandra::QCassandraContext::getColumnSlice().

Referenced by QtCassandra::QCassandraRow::readCells().

void QtCassandra::QCassandraTable::getValue ( const QByteArray &  row_key,
const QByteArray &  column_key,
QCassandraValue value 
) [private]

This function calls the context getValue() function to retrieve a value from Cassandra.

Parameters:
[in]row_keyThe key used to identify the row.
[in]column_keyThe key used to identify the column.
[in]valueThe new value of the cell.

Definition at line 1918 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, QtCassandra::QCassandraContext::getValue(), and tableName().

Referenced by QtCassandra::QCassandraRow::exists(), and QtCassandra::QCassandraRow::getValue().

int32_t QtCassandra::QCassandraTable::identifier ( ) const

Each table is identifier by a unique number. This function returns that unique number.

Returns:
The table identifier.

Definition at line 268 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::insertValue ( const QByteArray &  row_key,
const QByteArray &  column_key,
const QCassandraValue value 
) [private]

This function calls the context insertValue() function to save the new value that was defined in a cell.

Parameters:
[in]row_keyThe key used to identify the row.
[in]column_keyThe key used to identify the column.
[in]valueThe new value of the cell.

Definition at line 1902 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, QtCassandra::QCassandraContext::insertValue(), and tableName().

Referenced by QtCassandra::QCassandraRow::insertValue().

QString QtCassandra::QCassandraTable::keyAlias ( ) const

This function returns the alias of this table name.

This is only used by CQL at this point.

Returns:
The key alias.
See also:
unsetKeyAlias()
setKeyAlias()

Definition at line 464 of file QCassandraTable.cpp.

References f_private.

int32_t QtCassandra::QCassandraTable::keyCacheSavePeriodInSeconds ( ) const

This function returns the current number of seconds the cache should be retained in memory.

Returns:
The number of seconds before saving the cache.

Definition at line 770 of file QCassandraTable.cpp.

References f_private.

double QtCassandra::QCassandraTable::keyCacheSize ( ) const

This function returns the definition of the key cache.

Returns:
Cache size either as a % value (1.0 or less) or a Mb value (over 1.0)

Definition at line 731 of file QCassandraTable.cpp.

References f_private.

QString QtCassandra::QCassandraTable::keyValidationClass ( ) const

This function returns the current validation class for the table name.

Returns:
The current validation class for the table name.

Definition at line 424 of file QCassandraTable.cpp.

References f_private.

double QtCassandra::QCassandraTable::maxCompactionThreshold ( ) const

This function retrieves the current maximum compaction threshold.

Returns:
The maximum compaction threshold for this table.
See also:
setMaxCompactionThreshold()
unsetMaxCompactionThreshold()

Definition at line 881 of file QCassandraTable.cpp.

References f_private.

int32_t QtCassandra::QCassandraTable::memtableFlushAfterMins ( ) const

This function reads the number of minutes to wait before forcing a flush of a table from memory. A table that is not being accessed for that long gets removed.

Returns:
The number of minutes a cached table will be kept.

Definition at line 1068 of file QCassandraTable.cpp.

References f_private.

int32_t QtCassandra::QCassandraTable::memtableOperationsInMillions ( ) const

This function returns the current number of operations to perform on memory tables for this table before they get flushed.

Returns:
The number of operations in millions before a flush occurs.

Definition at line 1138 of file QCassandraTable.cpp.

References f_private.

int32_t QtCassandra::QCassandraTable::memtableThroughputInMb ( ) const

This function retrieve the current memtable throughput in megabytes.

Returns:
The memtable throughput in megabytes.

Definition at line 1105 of file QCassandraTable.cpp.

References f_private.

double QtCassandra::QCassandraTable::mergeShardsChance ( ) const

This function returns the chance the system will merge counter shards.

Returns:
The chance the system will merge counter shards.

Definition at line 954 of file QCassandraTable.cpp.

References f_private.

double QtCassandra::QCassandraTable::minCompactionThreshold ( ) const

This function reads the minimum compaction threshold.

Returns:
The minimum compaction threshold of this table.

Definition at line 842 of file QCassandraTable.cpp.

References f_private.

QCassandraRow & QtCassandra::QCassandraTable::operator[] ( const QString &  row_name)

This function retrieves a table row. If the named row doesn't exist yet, then it is created first.

The reference is writable so you make write to a cell in this row.

This function accepts a name for this row reference.

Parameters:
[in]row_nameThe name of the row to retrieve.
Returns:
A reference to a QCassandraRow.

Definition at line 1723 of file QCassandraTable.cpp.

References row().

QCassandraRow & QtCassandra::QCassandraTable::operator[] ( const QByteArray &  row_key)

This function retrieves a table row. If the keyed row doesn't exist yet, then it is created first.

The reference is writable so you make write to a cell in this row.

This function accepts a binary key for this row reference.

Parameters:
[in]row_keyThe binary key of the row to retrieve.
Returns:
A reference to a QCassandraRow.

Definition at line 1742 of file QCassandraTable.cpp.

References row().

const QCassandraRow & QtCassandra::QCassandraTable::operator[] ( const QString &  row_name) const

This function retrieves a table row. If the named row doesn't exist yet, then the function raises an error.

The reference is read-only (constant) so you may retrieve a cell value from it, but not modify the cell.

This function accepts a name as the row reference.

Exceptions:
std::runtime_errorThe function checks whether the named row exists. If not, then this error is raised because the function is constant and cannot create a new row.
Parameters:
[in]row_nameThe name of the row to retrieve.
Returns:
A constant reference to a QCassandraRow.

Definition at line 1766 of file QCassandraTable.cpp.

References findRow(), and row().

const QCassandraRow & QtCassandra::QCassandraTable::operator[] ( const QByteArray &  row_key) const

This function retrieves a table row. If the named row doesn't exist yet, then the function raises an error.

The reference is read-only (constant) so you may retrieve a cell value from it, but not modify the cell.

This function accepts a binary key as the row reference.

Exceptions:
std::runtime_errorThe function checks whether the named row exists. If not, then this error is raised because the function is constant and cannot create a new row.
Parameters:
[in]row_keyThe binary key of the row to retrieve.
Returns:
A constant reference to a QCassandraRow.

Definition at line 1793 of file QCassandraTable.cpp.

References findRow(), and row().

void QtCassandra::QCassandraTable::parseTableDefinition ( const void *  data) [private]

This function is called internally to parse a CfDef object. The data is saved in this QCassandraTabel.

Parameters:
[in]dataThe pointer to the CfDef object.

Definition at line 1164 of file QCassandraTable.cpp.

References columnDefinition(), f_column_definitions, f_from_cassandra, and f_private.

void QtCassandra::QCassandraTable::prepareTableDefinition ( void *  data) const [private]

This function transforms a QCassandra table definition into a Cassandra CfDef structure.

The parameter is passed as a void * because we do not want to define the thrift types in our public headers.

Parameters:
[in]dataThe CfDef were the table is to be saved.

Definition at line 1377 of file QCassandraTable.cpp.

References f_column_definitions, and f_private.

Referenced by QtCassandra::QCassandraPrivate::createTable(), and QtCassandra::QCassandraPrivate::updateTable().

double QtCassandra::QCassandraTable::readRepairChance ( ) const

This function returns the read repair chance value.

Returns:
The read repair chance value.

Definition at line 801 of file QCassandraTable.cpp.

References f_private.

uint32_t QtCassandra::QCassandraTable::readRows ( const QCassandraRowPredicate row_predicate = QCassandraRowPredicate())

This function reads a set of rows as defined by the row predicate.

To change the consistency for this read, check out the QCassandraColumnPredicate::setConsistencyLevel() function.

If the table is not connected to Cassandra (i.e. the table is a memory table) then nothing happens.

Remember that if you are querying without checking for any column you will get empty rows in your results (see dropRow() function for more information.)

Parameters:
[in]row_predicateThe row predicate.
Returns:
The number of rows read.
See also:
QCassandraColumnPredicate::setConsistencyLevel()
dropRow()

Definition at line 1537 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, and QtCassandra::QCassandraContext::getRowSlices().

Referenced by exists().

void QtCassandra::QCassandraTable::remove ( const QByteArray &  row_key,
const QByteArray &  column_key,
int64_t  timestamp,
consistency_level_t  consistency_level 
) [private]

This function removes a cell from the Cassandra database as specified by the parameters.

Parameters:
[in]row_keyThe row in which the cell is to be removed.
[in]column_keyThe cell to be removed.
[in]timestampThe time when the key to be removed was created.
[in]consistency_levelThe consistency level to use to remove this cell.

Definition at line 1989 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, QtCassandra::QCassandraContext::remove(), and tableName().

Referenced by QtCassandra::QCassandraRow::dropCell().

bool QtCassandra::QCassandraTable::replicateOnWrite ( ) const

This function retrieves the replicate on write flag for this table. If false, the data is only saved on the node you're connected to. If true, it will be duplicated as specified by the replication level.

Returns:
The replicate on write flag status.

Definition at line 918 of file QCassandraTable.cpp.

References f_private.

QSharedPointer< QCassandraRow > QtCassandra::QCassandraTable::row ( const QString &  row_name)

This function searches for a row or, if it doesn't exist, create a new row.

Note that unless you set the value of a column in this row, the row will never appear in the Cassandra cluster.

This function accepts a name for the row. The name is a UTF-8 string.

Parameters:
[in]row_nameThe name of the row to search or create.
Returns:
A shared pointer to the matching row or a null pointer.

Definition at line 1559 of file QCassandraTable.cpp.

Referenced by assignRow(), and operator[]().

QSharedPointer< QCassandraRow > QtCassandra::QCassandraTable::row ( const QByteArray &  row_key)

This function searches for a row or, if it doesn't exist, create a new row.

Note that unless you set the value of a column in this row, the row will never appear in the Cassandra cluster.

This function assigns the row a binary key.

Parameters:
[in]row_keyThe name of the row to search or create.
Returns:
A shared pointer to the matching row or a null pointer.

Definition at line 1578 of file QCassandraTable.cpp.

References f_rows, and QCassandraRow.

QString QtCassandra::QCassandraTable::rowCacheProvider ( ) const

This function retrieves the row cache provider class name.

Returns:
The row cache provider.

Definition at line 987 of file QCassandraTable.cpp.

References f_private.

int32_t QtCassandra::QCassandraTable::rowCacheSavePeriodInSeconds ( ) const

This function retrieves the row cache save period in seconds.

The value may be 0.

Returns:
The cache save period in seconds.

Definition at line 695 of file QCassandraTable.cpp.

References f_private.

double QtCassandra::QCassandraTable::rowCacheSize ( ) const

This function returns the current size of the row cache.

Returns:
The current row cache size.

Definition at line 657 of file QCassandraTable.cpp.

References f_private.

const QCassandraRows & QtCassandra::QCassandraTable::rows ( ) const

This function returns a constant reference to the map listing all the rows currently defined in memory for this table.

This can be used to determine how many rows are defined in memory and to scan all the data.

Returns:
A constant reference to a map of rows.

Definition at line 1602 of file QCassandraTable.cpp.

References f_rows.

void QtCassandra::QCassandraTable::setColumnType ( const QString &  column_type)

The default column type is "Standard". It may also be set to "Super".

Exceptions:
std::runtime_errorThis error is generated whenever the column_type parameter is not set to either "Standard" or "Super".
Parameters:
[in]column_typeThe named type of this table definition column.

Definition at line 320 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setComment ( QString  comment)

This function saves a new comment in the table definition.

This is any human readable comment that you want to attach with this table. It is mainly useful for documentation purpose.

Parameters:
[in]commentThe new table comment.

Definition at line 282 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setComparatorType ( const QString &  comparator_type)

Define the type of comparator to use to compare columns in queries.

The default comparator is "BytesType".

The type must be one of the supported Cassandra types (

See also:
setColumnType()) or the fully qualified name of a class you added.

A common column type is BytesType for binary data. In most cases this will be used as the default.

The internal types available are:

(those marked with an asterisk (*) are defined in the CLI documentation for CREATE COLUMN FAMILY function; if they are not defined there, it is either not available or that documentation was not up to date)

  • AsciiType (*)
  • BooleanType
  • BytesType (*)
  • CounterColumnType (*)
  • DateType
  • DoubleType
  • FloatType
  • IntegerType (*)
  • LexicalUUIDType (*)
  • LongType (*)
  • TimeUUIDType
  • UTF8Type (*)
  • UUIDType

Note that all these types are not available for all the different keys.

Some types that are defined but are probably not available to us as is:

  • CompositeType (a record of some sort?)
  • DynamicCompositeType (a changing record of some sort?)
  • LocalByPartitionerType (TBD?)
Note:
This function does not check the validity of the parameter since it has no way of knowing whether the parameter is a valid type.
Parameters:
[in]comparator_typeThe type of the column comparator.

Definition at line 515 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setDefaultValidationClass ( const QString &  validation_class)

This function defines the default validation class for the table columns. By default it is set to binary (BytesType), which is similar to saying no validation is required.

The CLI documentation says that the following are valid as a default validation class:

AsciiType, BytesType, CounterColumnType, IntegerType, LexicalUUIDType, LongType, UTF8Type

Parameters:
[in]validation_classThe default validation class for columns data.

Definition at line 363 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setFromCassandra ( ) [private]

This very case happens when the user creates a new context that, at the time of calling QCassandraContext::create(), includes a list of table definitions.

In that case we know that the context is being created, but not the tables because the server does it transparently in one go.

Definition at line 1152 of file QCassandraTable.cpp.

References f_from_cassandra.

void QtCassandra::QCassandraTable::setGcGraceSeconds ( int32_t  seconds)

Cassandra uses a garbage collection mechanism to manage its data.

The default value for this parameter is 10 days (864000.) This value needs to be large enough for your entire ring of nodes to clear their garbage collection before a new cycle starts (don't ask me! I would think they should have a flag to prevent two such collections... but there are problems difficult to circumvent with potential hardware failures.)

Parameters:
[in]secondsHow often tombstones are searched for.

Definition at line 1004 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setIdentifier ( int32_t  identifier)

This function is provided to let the user choose an identifier for his tables. Identifiers must be unique and in general it is better to let the system define an identifier for you.

Parameters:
[in]identifierThe identifier to use for this table.

Definition at line 245 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setKeyAlias ( const QString &  key_alias)

Each table name can make use of one key alias as defined by this entry.

This is used by CQL at this point so the key can be represented by a name other than KEY. This way it looks a little more like a column name. Note that the alias cannot match the name of any one column.

Parameters:
[in]key_aliasThe new key alias to use with the table definition.

Definition at line 439 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setKeyCacheSavePeriodInSeconds ( int32_t  seconds)

This function defines the number of seconds to wait before saving the cached keys on disk. This is useful if you want to restart Cassandra with a non empty cache.

If you rarely restart Cassandra, a larger number is better.

The default is 0.

Parameters:
[in]secondsThe number of seconds the data should be kept in memory.

Definition at line 748 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setKeyCacheSize ( double  size)

Set the size of the cache where keys are saved. This cache is used to quickly search the location of rows. This is similar to an in memory index.

The size can either be expressed in a percent (0.01 to 0.99) or as an absolute number of keys (200,000).

Parameters:
[in]sizeThe size of the key cache.

Definition at line 710 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setKeyValidationClass ( const QString &  validation_class)

The table name is called a key. This key can be used in queries and as such may need to be of a very specific type. This function can be used to define that type.

The supported types for a table key are:

AsciiType, BytesType, IntegerType, LexicalUUIDType, LongType, UTF8Type

The default is BytesType, which means not validation is applied to the key.

Parameters:
[in]validation_classThe new key validation class for this table name.

Definition at line 403 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setMaxCompactionThreshold ( int32_t  threshold)

This function sets the maximum compaction threshold of a table. When this limit is reached, then files are concatenated to ensure better read access times.

Setting the compaction to zero disables this feature.

Parameters:
[in]thresholdThe maximum threshold before compaction occurs.

Definition at line 857 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setMemtableFlushAfterMins ( int32_t  minutes)

This function defines how often tables cached in memory get flushed to disk (i.e. when they are that old, write a copy.)

This flush function forces the flush whether or not the number of operations or size limits were reached.

It should be larger on production systems. Cassandra recommends you to use 1 day (1,440 minutes.) The default is 60 (1h.)

Parameters:
[in]minutesThe number of minutes a table will be kept in the memory cache.

Definition at line 1044 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setMemtableOperationsInMillions ( int32_t  operations)

This function defines the number of operations that can be executed against a memory table before it gets flushed.

Parameters:
[in]operationsThe number of operations in millions.

Definition at line 1117 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setMemtableThroughputInMb ( int32_t  megabytes)

This function sets the memtable throughput in megabytes. This means the tables are flushed after that much data was written to them.

A larger number is better especially if you send many writes to Cassandra in random order (i.e. not sorted.) However, this represents a lot of memory buffers and you want to avoid swapping.

Parameters:
[in]megabytesThe number of megabytes.

Definition at line 1084 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setMergeShardsChance ( double  merge_shards_chance)

Counters may generate a contention. To break that contention, it is possible to break them up into shards (counter sharding). This value defines the chance that the system will reverse the process.

The default is 0.0

Parameters:
[in]merge_shards_chanceThe chance that shards get merged.

Definition at line 933 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setMinCompactionThreshold ( int32_t  threshold)

This function is used to change the minimum size to reach before compacting data on disk.

Data is saved in separate files. Reading multiple files is slow. The compaction mechanism is used to concatenate multiple files one after another. This makes the read of older data much faster.

Data that constantly changes should have a larger threshold since it otherwise would often break up the compaction anyway.

Setting the compaction to zero disables this feature.

Parameters:
[in]thresholdThe threshold before compressing data.

Definition at line 822 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setReadRepairChance ( double  repair_chance)

This function can be used to change the read repair chance value.

Parameters:
[in]repair_chanceThe chance to repair data for a read.

Definition at line 781 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setReplicateOnWrite ( bool  replicate_on_write)

This function defines the replication flag. On write you can ask for counters to be replicated (the default) on other nodes.

Parameters:
[in]replicate_on_writeWhether counters are replicated on different nodes.

Definition at line 894 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setRowCacheProvider ( const QString &  provider)

The class to be used to as the row cache provider.

It defaults to: org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider.

Parameters:
[in]providerThe row cache provider class name.

Definition at line 967 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setRowCacheSavePeriodInSeconds ( int32_t  seconds)

It is possible, with Cassandra, to save the cache to disk. This allows you to restart Cassandra with a non-empty cache. Whether this is useful will very much depend on your data.

If you rarely restart Cassandra, then a larger number is better.

Parameters:
[in]secondsThe number of seconds the cache is retained for.

Definition at line 672 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setRowCacheSize ( double  size)

This function defines the number of rows from this table that should be cached.

By default this is set to zero as by default no rows are being cached. A very large table may benefit from a cache but really only if you know that the same row(s) will be hit over and over again.

The size can either be expressed in a percent (0.01 to 0.99) or as an absolute number of rows (200000).

Parameters:
[in]sizeThe size required for this table row cache.

Definition at line 637 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::setSubcomparatorType ( const QString &  subcomparator_type)

This function sets the sub-comparator type of this table definition. The sub-comparator is used against super columns data.

You cannot define the sub-comparator type on a Standard table. Only Super tables accepts this parameter.

The default is undefined.

Parameters:
[in]subcomparator_typeThe new sub-comparator type.

Definition at line 553 of file QCassandraTable.cpp.

References f_private.

QString QtCassandra::QCassandraTable::subcomparatorType ( ) const

This function retrieves the sub-comparator type and return its name. If no sub-comparator is defined, an empty string is returned ("").

Returns:
The sub-comparator or an empty string.

Definition at line 575 of file QCassandraTable.cpp.

References f_private.

QString QtCassandra::QCassandraTable::tableName ( ) const

This function returns the name of this table. Note that the name cannot be changed.

Returns:
The table name.

Definition at line 232 of file QCassandraTable.cpp.

References f_private.

Referenced by getCellCount(), QtCassandra::QCassandraPrivate::getColumnSlice(), QtCassandra::QCassandraPrivate::getRowSlices(), getValue(), insertValue(), remove(), and QtCassandra::QCassandraPrivate::truncateTable().

void QtCassandra::QCassandraTable::truncate ( )

The truncate() function removes all the rows from a Cassandra table and clear out the cached data (rows and cells.)

If the table is not connected to Cassandra, then nothing happens with the Cassandra server.

If you want to keep a copy of the cache, you will have to retrieve a copy of the rows map using the rows() function.

See also:
rows()
clearCache()

Definition at line 1506 of file QCassandraTable.cpp.

References clearCache(), f_context, f_from_cassandra, and QtCassandra::QCassandraContext::truncateTable().

void QtCassandra::QCassandraTable::unsetColumnType ( )

This function clears the set of the column type.

Definition at line 333 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetComment ( )

This function marks the comment as not set.

Definition at line 291 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetComparatorType ( )

This function resets the comparator flag to false so it looks like the comparator wasn't set. The default or current value will be used instead.

Definition at line 525 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetDefaultValidationClass ( )

This function removes the effects of setDefaultValidationClass() calls.

Definition at line 372 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetGcGraceSeconds ( )

This function marks the Garbage Collection Grace period as unset.

Definition at line 1014 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetIdentifier ( )

This function marks the table identifier as unset. This is the default when creating a new table as you expect the system to generate the necessary identifier.

Definition at line 256 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetKeyAlias ( )

Cancel the effect of a previous setKeyAlias() call.

Definition at line 448 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetKeyCacheSavePeriodInSeconds ( )

This function marks the key cache save period in seconds parameter as not set.

Definition at line 758 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetKeyCacheSize ( )

This function removes the effect of previous calls to the setKeyCacheSize() function.

Definition at line 720 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetKeyValidationClass ( )

This function marks the key validation class parameter as unset so it doesn't get sent to the Cassandra serer.

Definition at line 413 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetMaxCompactionThreshold ( )

This function marks the maximum compaction parameter as unset.

Definition at line 867 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetMemtableFlushAfterMins ( )

This function cancels the effects of the setMemtableFlushAfterMins() call.

See also:
setMemtableFlushAfterMins()

Definition at line 1055 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetMemtableOperationsInMillions ( )

This function marks the memory table operations in millions as unset.

Definition at line 1126 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetMemtableThroughputInMb ( )

This function marks the table definition as not having a memtable throughput value.

Definition at line 1094 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetMergeShardsChance ( )

Mark the merge shards chance value as unset.

Definition at line 942 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetMinCompactionThreshold ( )

This function cancels calls to the setMinCompactionThreshold() function.

Definition at line 831 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetReadRepairChance ( )

This function marks the read repair chance as unset.

Definition at line 790 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetReplicateOnWrite ( )

This function cancels the setReplicateOnWrite() function call by marking the flag as unset.

Definition at line 904 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetRowCacheProvider ( )

This function cancels the call to the setRowCacheProvider() function.

Definition at line 976 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetRowCacheSavePeriodInSeconds ( )

This function marks the row cache save period in seconds as not set at all.

Definition at line 682 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetRowCacheSize ( )

This function marks the row cache size as unset.

Definition at line 646 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::unsetSubcomparatorType ( )

This function marks the sub-comparator type as unset.

Definition at line 562 of file QCassandraTable.cpp.

References f_private.

void QtCassandra::QCassandraTable::update ( )

This function is used to completely delete a table from the Cassandra system. After this call, the table is gone.

The table cannot be used anymore without first calling create() again.

This function is most often used to define new column types or changing existing columns (although changing existing columns may not work as expected, from what I understand, TBD.)

Definition at line 1463 of file QCassandraTable.cpp.

References f_context, f_from_cassandra, and QtCassandra::QCassandraContext::updateTable().


Friends And Related Function Documentation

friend class QCassandraContext [friend]

Definition at line 185 of file QCassandraTable.h.

friend class QCassandraPrivate [friend]

Definition at line 184 of file QCassandraTable.h.

friend class QCassandraRow [friend]

Definition at line 187 of file QCassandraTable.h.

Referenced by row().

friend class QCassandraTablePrivate [friend]

Definition at line 186 of file QCassandraTable.h.


Member Data Documentation

Column definitions are used to define a type for the data saved in that row. These definitions are not currently used by the libQtCassandra itself. It is used by the Cassandra server however.

Column definitions are generally required on columns you want to use to index your data.

Definition at line 195 of file QCassandraTable.h.

Referenced by columnDefinition(), columnDefinitions(), parseTableDefinition(), and prepareTableDefinition().

A table is always part of a specific context. You can only create a new table using a function from your context objects.

This is a bare pointer since you cannot delete the context and hope the table remains (i.e. when the context goes, the table goes!)

Definition at line 194 of file QCassandraTable.h.

Referenced by context(), create(), getCellCount(), getColumnSlice(), getValue(), insertValue(), readRows(), remove(), truncate(), and update().

A table read from the Cassandra server or created with the create() function is marked as being from Cassandra. All other tables are considered memory tables.

A memory table can be used as a set of global variables with a format similar to a Cassandra table.

If you define a new table with the intend to call the create() function, avoid saving data in the new table as it won't make it to the database. (This may change in the future though.)

Definition at line 189 of file QCassandraTable.h.

Referenced by create(), getCellCount(), getColumnSlice(), getValue(), insertValue(), parseTableDefinition(), readRows(), remove(), setFromCassandra(), truncate(), and update().

A table is always part of a specific context. You can only create a new table using a function from your context objects.

This is a bare pointer since you cannot delete the context and hope the table remains (i.e. when the context goes, the table goes!)

Definition at line 190 of file QCassandraTable.h.

Referenced by columnType(), comment(), comparatorType(), contextName(), defaultValidationClass(), gcGraceSeconds(), identifier(), keyAlias(), keyCacheSavePeriodInSeconds(), keyCacheSize(), keyValidationClass(), maxCompactionThreshold(), memtableFlushAfterMins(), memtableOperationsInMillions(), memtableThroughputInMb(), mergeShardsChance(), minCompactionThreshold(), parseTableDefinition(), prepareTableDefinition(), QCassandraTable(), readRepairChance(), replicateOnWrite(), rowCacheProvider(), rowCacheSavePeriodInSeconds(), rowCacheSize(), setColumnType(), setComment(), setComparatorType(), setDefaultValidationClass(), setGcGraceSeconds(), setIdentifier(), setKeyAlias(), setKeyCacheSavePeriodInSeconds(), setKeyCacheSize(), setKeyValidationClass(), setMaxCompactionThreshold(), setMemtableFlushAfterMins(), setMemtableOperationsInMillions(), setMemtableThroughputInMb(), setMergeShardsChance(), setMinCompactionThreshold(), setReadRepairChance(), setReplicateOnWrite(), setRowCacheProvider(), setRowCacheSavePeriodInSeconds(), setRowCacheSize(), setSubcomparatorType(), subcomparatorType(), tableName(), unsetColumnType(), unsetComment(), unsetComparatorType(), unsetDefaultValidationClass(), unsetGcGraceSeconds(), unsetIdentifier(), unsetKeyAlias(), unsetKeyCacheSavePeriodInSeconds(), unsetKeyCacheSize(), unsetKeyValidationClass(), unsetMaxCompactionThreshold(), unsetMemtableFlushAfterMins(), unsetMemtableOperationsInMillions(), unsetMemtableThroughputInMb(), unsetMergeShardsChance(), unsetMinCompactionThreshold(), unsetReadRepairChance(), unsetReplicateOnWrite(), unsetRowCacheProvider(), unsetRowCacheSavePeriodInSeconds(), unsetRowCacheSize(), and unsetSubcomparatorType().

The system caches rows in this map. The map index is the row key. You can clear the table using the clearCache() function.

Definition at line 196 of file QCassandraTable.h.

Referenced by clearCache(), dropRow(), exists(), findRow(), getCellCount(), row(), and rows().


The documentation for this class was generated from the following files:
  • /home/alexis/m2osw/sources/freeware/snapwebsites/libQtCassandra/include/QtCassandra/QCassandraTable.h
  • /home/alexis/m2osw/sources/freeware/snapwebsites/libQtCassandra/src/QCassandraTable.cpp

This document is part of the libQtCassandra Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly