org.apache.cassandra.db.index.keys
Class KeysIndex

java.lang.Object
  extended by org.apache.cassandra.db.index.SecondaryIndex
      extended by org.apache.cassandra.db.index.PerColumnSecondaryIndex
          extended by org.apache.cassandra.db.index.keys.KeysIndex

public class KeysIndex
extends PerColumnSecondaryIndex

Implements a secondary index for a column family using a second column family in which the row keys are indexed values, and column names are base row keys.


Field Summary
 
Fields inherited from class org.apache.cassandra.db.index.SecondaryIndex
baseCfs, columnDefs, CUSTOM_INDEX_OPTION_NAME
 
Constructor Summary
KeysIndex()
           
 
Method Summary
 SecondaryIndexSearcher createSecondaryIndexSearcher(java.util.Set<java.nio.ByteBuffer> columns)
          Called at query time Creates a implementation specific searcher instance for this index type
 void deleteColumn(DecoratedKey<?> valueKey, java.nio.ByteBuffer rowKey, IColumn column)
          Delete a column from the index
 void forceBlockingFlush()
          Forces this indexes in memory data to disk
 java.lang.String getIndexName()
           
 ColumnFamilyStore getUnderlyingCfs()
          Allow access to the underlying column family store if there is one
static AbstractType indexComparator()
           
 void init()
          Perform any initialization work
 void insertColumn(DecoratedKey<?> valueKey, java.nio.ByteBuffer rowKey, IColumn column)
          insert a column to the index
 void removeIndex(java.nio.ByteBuffer columnName)
          Delete all files and references to this index
 void renameIndex(java.lang.String newCfName)
          Renames the underlying index files to reflect the new CF name
 void unregisterMbean()
          Unregisters this index's mbean if one exists
 void updateColumn(DecoratedKey<?> valueKey, java.nio.ByteBuffer rowKey, IColumn col)
          update a column from the index
 void validateOptions()
          Validates the index_options passed in the ColumnDef
 
Methods inherited from class org.apache.cassandra.db.index.PerColumnSecondaryIndex
getNameForSystemTable
 
Methods inherited from class org.apache.cassandra.db.index.SecondaryIndex
buildIndexAsync, buildIndexBlocking, createInstance, getBaseCFStore, isIndexBuilt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeysIndex

public KeysIndex()
Method Detail

init

public void init()
Description copied from class: SecondaryIndex
Perform any initialization work

Specified by:
init in class SecondaryIndex

indexComparator

public static AbstractType indexComparator()

deleteColumn

public void deleteColumn(DecoratedKey<?> valueKey,
                         java.nio.ByteBuffer rowKey,
                         IColumn column)
Description copied from class: PerColumnSecondaryIndex
Delete a column from the index

Specified by:
deleteColumn in class PerColumnSecondaryIndex
Parameters:
valueKey - the column value which is used as the index key
rowKey - the underlying row key which is indexed
column - all the column info

insertColumn

public void insertColumn(DecoratedKey<?> valueKey,
                         java.nio.ByteBuffer rowKey,
                         IColumn column)
Description copied from class: PerColumnSecondaryIndex
insert a column to the index

Specified by:
insertColumn in class PerColumnSecondaryIndex
Parameters:
valueKey - the column value which is used as the index key
rowKey - the underlying row key which is indexed
column - all the column info

updateColumn

public void updateColumn(DecoratedKey<?> valueKey,
                         java.nio.ByteBuffer rowKey,
                         IColumn col)
Description copied from class: PerColumnSecondaryIndex
update a column from the index

Specified by:
updateColumn in class PerColumnSecondaryIndex
Parameters:
valueKey - the column value which is used as the index key
rowKey - the underlying row key which is indexed
col - all the column info

removeIndex

public void removeIndex(java.nio.ByteBuffer columnName)
                 throws java.io.IOException
Description copied from class: SecondaryIndex
Delete all files and references to this index

Specified by:
removeIndex in class SecondaryIndex
Parameters:
columnName - the indexed column to remove
Throws:
java.io.IOException

forceBlockingFlush

public void forceBlockingFlush()
                        throws java.io.IOException
Description copied from class: SecondaryIndex
Forces this indexes in memory data to disk

Specified by:
forceBlockingFlush in class SecondaryIndex
Throws:
java.io.IOException

unregisterMbean

public void unregisterMbean()
Description copied from class: SecondaryIndex
Unregisters this index's mbean if one exists

Specified by:
unregisterMbean in class SecondaryIndex

getUnderlyingCfs

public ColumnFamilyStore getUnderlyingCfs()
Description copied from class: SecondaryIndex
Allow access to the underlying column family store if there is one

Specified by:
getUnderlyingCfs in class SecondaryIndex
Returns:
the underlying column family store or null

createSecondaryIndexSearcher

public SecondaryIndexSearcher createSecondaryIndexSearcher(java.util.Set<java.nio.ByteBuffer> columns)
Description copied from class: SecondaryIndex
Called at query time Creates a implementation specific searcher instance for this index type

Specified by:
createSecondaryIndexSearcher in class SecondaryIndex
Parameters:
columns - the list of columns which belong to this index type
Returns:
the secondary index search impl

getIndexName

public java.lang.String getIndexName()
Specified by:
getIndexName in class SecondaryIndex
Returns:
The name of the index

renameIndex

public void renameIndex(java.lang.String newCfName)
                 throws java.io.IOException
Description copied from class: SecondaryIndex
Renames the underlying index files to reflect the new CF name

Specified by:
renameIndex in class SecondaryIndex
Parameters:
newCfName - new column family name.
Throws:
java.io.IOException - on any I/O error.

validateOptions

public void validateOptions()
                     throws ConfigurationException
Description copied from class: SecondaryIndex
Validates the index_options passed in the ColumnDef

Specified by:
validateOptions in class SecondaryIndex
Throws:
ConfigurationException


Copyright © 2011 The Apache Software Foundation