Package org.apache.cassandra.index
Interface Index.Group
- All Known Implementing Classes:
SASIIndexGroup,SingletonIndexGroup,StorageAttachedIndexGroup
- Enclosing interface:
- Index
public static interface Index.Group
Class providing grouped operations for indexes that communicate with each other.
Index implementations should provide a
Group implementation calling to
SecondaryIndexManager.registerIndex(Index, Index.Group.Key, Supplier) during index registering
at Index.register(IndexRegistry) method.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classGroup key is used to uniquely identify aIndex.Groupwithin a table -
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdds the specifiedIndexas a member of this group.booleancontainsIndex(Index index) Returns if this group contains the specifiedIndex.Returns the SSTable-attachedComponents created by this index group.getFlushObserver(Descriptor descriptor, LifecycleNewTracker tracker, TableMetadata tableMetadata) Get flush observer to observe partition/cell events generated by flushing SSTable (memtable flush or compaction).Returns the indexes that are members of this group.default booleanhandles(IndexTransaction.Type type) indexerFor(Predicate<Index> indexSelector, DecoratedKey key, RegularAndStaticColumns columns, long nowInSec, WriteContext ctx, IndexTransaction.Type transactionType, Memtable memtable) Creates an newIndexerobject for updates to a given partition.default voidCalled when the table associated with this group has been invalidated or all indexes in the group are removed.default booleanReturns whether this group can only ever contain a single index.queryPlanFor(RowFilter rowFilter) Returns a newIndex.QueryPlanfor the specifiedRowFilter, ornullif none of the indexes in this group supports the expression in the row filter.default voidremoveIndex(Index index) Removes the specifiedIndexfrom the members of this group.default booleanWhether this index group supports sharding when flushing memtables, e.g.default booleanvalidateSSTableAttachedIndexes(Collection<SSTableReader> sstables, boolean throwOnIncomplete, boolean validateChecksum) Validates all indexes in the group against the specified SSTables.
-
Method Details
-
getIndexes
Returns the indexes that are members of this group.- Returns:
- the indexes that are members of this group
-
addIndex
Adds the specifiedIndexas a member of this group.- Parameters:
index- the index to be added
-
removeIndex
Removes the specifiedIndexfrom the members of this group.- Parameters:
index- the index to be removed
-
containsIndex
Returns if this group contains the specifiedIndex.- Parameters:
index- the index to be removed- Returns:
trueif this group containsindex,falseotherwise
-
isSingleton
default boolean isSingleton()Returns whether this group can only ever contain a single index.- Returns:
trueif this group only contains a single index,falseotherwise
-
indexerFor
Index.Indexer indexerFor(Predicate<Index> indexSelector, DecoratedKey key, RegularAndStaticColumns columns, long nowInSec, WriteContext ctx, IndexTransaction.Type transactionType, Memtable memtable) Creates an newIndexerobject for updates to a given partition.- Parameters:
indexSelector- a predicate selecting the targeted memberskey- key of the partition being modifiedcolumns- the regular and static columns the created indexer will have to deal with. This can be empty as an update might only contain partition, range and row deletions, but the indexer is guaranteed to not get any cells for a column that is not part ofcolumns.nowInSec- current time of the update operationctx- WriteContext spanning the update operationtransactionType- indicates what kind of update is being performed on the base data i.e. a write time insert/update/delete or the result of compactionmemtable- theMemtableto which the updates are being applied ornullif the source of the updates is an existingSSTable- Returns:
- the newly created indexer or
nullif the index is not interested by the update (this could be because the index doesn't care about that particular partition, doesn't care about that type of transaction, ...).
-
queryPlanFor
Returns a newIndex.QueryPlanfor the specifiedRowFilter, ornullif none of the indexes in this group supports the expression in the row filter.- Parameters:
rowFilter- a row filter- Returns:
- a new query plan for the specified
RowFilterif it's supported,nullotherwise
-
getFlushObserver
SSTableFlushObserver getFlushObserver(Descriptor descriptor, LifecycleNewTracker tracker, TableMetadata tableMetadata) Get flush observer to observe partition/cell events generated by flushing SSTable (memtable flush or compaction).- Parameters:
descriptor- The descriptor of the sstable observer is requested for.tracker- TheLifecycleNewTrackerassociated with the SSTable being writtentableMetadata- The immutable metadata of the table at the moment the SSTable is flushed- Returns:
- SSTable flush observer.
-
handles
- Parameters:
type- index transaction type- Returns:
- true if index will be able to handle given index transaction type
-
invalidate
default void invalidate()Called when the table associated with this group has been invalidated or all indexes in the group are removed. Implementations should dispose of any resources tied to the lifecycle of theIndex.Group. -
getComponents
Returns the SSTable-attachedComponents created by this index group.- Returns:
- the SSTable components created by this group
-
validateSSTableAttachedIndexes
default boolean validateSSTableAttachedIndexes(Collection<SSTableReader> sstables, boolean throwOnIncomplete, boolean validateChecksum) Validates all indexes in the group against the specified SSTables.- Parameters:
sstables- SSTables for which indexes in the group should be builtthrowOnIncomplete- whether to throw an error if any index in the group is incompletevalidateChecksum- whether checksum will be tested as part of the validation- Returns:
- true if all indexes in the group are complete and valid
false if any index is incomplete and
throwOnIncompleteis false - Throws:
IllegalStateException- ifthrowOnIncompleteis true and any index in the group is incompleteUncheckedIOException- if there is a problem validating any on-disk component of an index in the group
-
supportsL0Shards
default boolean supportsL0Shards()Whether this index group supports sharding when flushing memtables, e.g. level 0 of UCS.- Returns:
- true iff all indexes in the group support L0 sharding.
-