public abstract class SecondaryIndex
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected ColumnFamilyStore |
baseCfs
Base CF that has many indexes
|
protected java.util.Set<ColumnDefinition> |
columnDefs
The column definitions which this index is responsible for
|
static java.lang.String |
CUSTOM_INDEX_OPTION_NAME |
static java.lang.String |
INDEX_ENTRIES_OPTION_NAME
The name of the option used to specify that the index is on the collection (map) entries.
|
static java.lang.String |
INDEX_KEYS_OPTION_NAME
The name of the option used to specify that the index is on the collection keys.
|
static java.lang.String |
INDEX_VALUES_OPTION_NAME
The name of the option used to specify that the index is on the collection values.
|
static AbstractType<?> |
keyComparator |
protected static org.slf4j.Logger |
logger |
Constructor and Description |
---|
SecondaryIndex() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
baseKeyspace() |
protected java.lang.String |
baseTable() |
java.util.concurrent.Future<?> |
buildIndexAsync()
Builds the index using the data in the underlying CF, non blocking
|
protected void |
buildIndexBlocking()
Builds the index using the data in the underlying CFS
Blocks till it's complete
|
static SecondaryIndex |
createInstance(ColumnFamilyStore baseCfs,
ColumnDefinition cdef)
This is the primary way to create a secondary index instance for a CF column.
|
protected abstract SecondaryIndexSearcher |
createSecondaryIndexSearcher(java.util.Set<ColumnDefinition> columns)
Called at query time
Creates a implementation specific searcher instance for this index type
|
abstract long |
estimateResultRows() |
abstract void |
forceBlockingFlush()
Forces this indexes' in memory data to disk
|
ColumnFamilyStore |
getBaseCfs() |
java.util.Set<ColumnDefinition> |
getColumnDefs() |
abstract ColumnFamilyStore |
getIndexCfs()
Allow access to the underlying column family store if there is one
|
DecoratedKey |
getIndexKeyFor(java.nio.ByteBuffer value)
Returns the decoratedKey for a column value.
|
abstract java.lang.String |
getIndexName() |
abstract java.lang.String |
getNameForSystemKeyspace(java.nio.ByteBuffer columnName)
Return the unique name for this index and column
to be stored in the SystemKeyspace that tracks if each column is built
|
abstract boolean |
indexes(ColumnDefinition column)
Returns true if the provided column is indexed by this secondary index.
|
abstract void |
init()
Perform any initialization work
|
abstract void |
invalidate()
Remove the index and unregisters this index's mbean if one exists
|
boolean |
isIndexBuilt(java.nio.ByteBuffer columnName)
Checks if the index for specified column is fully built
|
static CFMetaData |
newIndexMetadata(CFMetaData baseMetadata,
ColumnDefinition def)
Create the index metadata for the index on a given column of a given table.
|
abstract void |
reload()
Reload an existing index following a change to its configuration,
or that of the indexed column(s).
|
abstract void |
removeIndex(java.nio.ByteBuffer columnName)
Delete all files and references to this index
|
void |
setIndexBuilt() |
void |
setIndexRemoved() |
boolean |
supportsOperator(Operator operator)
Returns true if the index supports lookups for the given operator, false otherwise.
|
java.lang.String |
toString() |
abstract void |
truncateBlocking(long truncatedAt)
Truncate all the data from the current index
|
abstract void |
validate(java.nio.ByteBuffer cellValue,
CellPath path) |
abstract void |
validate(Clustering clustering) |
abstract void |
validate(DecoratedKey partitionKey) |
abstract void |
validateOptions()
Validates the index_options passed in the ColumnDef
|
protected static final org.slf4j.Logger logger
public static final java.lang.String CUSTOM_INDEX_OPTION_NAME
public static final java.lang.String INDEX_KEYS_OPTION_NAME
public static final java.lang.String INDEX_VALUES_OPTION_NAME
public static final java.lang.String INDEX_ENTRIES_OPTION_NAME
public static final AbstractType<?> keyComparator
protected ColumnFamilyStore baseCfs
protected final java.util.Set<ColumnDefinition> columnDefs
public abstract void init()
public abstract void reload()
public abstract void validateOptions() throws ConfigurationException
ConfigurationException
public abstract java.lang.String getIndexName()
public abstract java.lang.String getNameForSystemKeyspace(java.nio.ByteBuffer columnName)
columnName
- the name of the columnpublic boolean isIndexBuilt(java.nio.ByteBuffer columnName)
columnName
- the columnpublic void setIndexBuilt()
public void setIndexRemoved()
protected abstract SecondaryIndexSearcher createSecondaryIndexSearcher(java.util.Set<ColumnDefinition> columns)
columns
- the list of columns which belong to this index typepublic abstract void forceBlockingFlush()
public abstract ColumnFamilyStore getIndexCfs()
public abstract void removeIndex(java.nio.ByteBuffer columnName)
columnName
- the indexed column to removepublic abstract void invalidate()
public abstract void truncateBlocking(long truncatedAt)
truncatedAt
- The truncation timestamp, all data before that timestamp should be rejected.protected void buildIndexBlocking()
public java.util.concurrent.Future<?> buildIndexAsync()
public ColumnFamilyStore getBaseCfs()
public java.util.Set<ColumnDefinition> getColumnDefs()
public boolean supportsOperator(Operator operator)
public DecoratedKey getIndexKeyFor(java.nio.ByteBuffer value)
value
- column valuepublic abstract boolean indexes(ColumnDefinition column)
public static SecondaryIndex createInstance(ColumnFamilyStore baseCfs, ColumnDefinition cdef) throws ConfigurationException
baseCfs
- the source of data for the Indexcdef
- the meta information about this column (index_type, index_options, name, etc...)ConfigurationException
public abstract void validate(DecoratedKey partitionKey) throws InvalidRequestException
InvalidRequestException
public abstract void validate(Clustering clustering) throws InvalidRequestException
InvalidRequestException
public abstract void validate(java.nio.ByteBuffer cellValue, CellPath path) throws InvalidRequestException
InvalidRequestException
public abstract long estimateResultRows()
protected java.lang.String baseKeyspace()
protected java.lang.String baseTable()
public static CFMetaData newIndexMetadata(CFMetaData baseMetadata, ColumnDefinition def)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015 The Apache Software Foundation