org.apache.cassandra.db.index.composites

## Class CompositesIndexOnCollectionValue

- java.lang.Object
- - org.apache.cassandra.db.index.SecondaryIndex
  - - org.apache.cassandra.db.index.PerColumnSecondaryIndex
    - - org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex
      - - org.apache.cassandra.db.index.composites.CompositesIndex
        - - org.apache.cassandra.db.index.composites.CompositesIndexOnCollectionValue

-     public class CompositesIndexOnCollectionValue
      extends CompositesIndex

  Index the value of a collection cell. This is a lot like an index on REGULAR, except that we also need to make the collection key part of the index entry so that: 1) we don't have to scan the whole collection at query time to know the entry is stale and if it still satisfies the query. 2) if a collection has multiple time the same value, we need one entry for each so that if we delete one of the value only we only delete the entry corresponding to that value.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.db.index.composites.CompositesIndex

      `CompositesIndex.IndexedEntry`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex

      `columnDef, indexCfs`

    - ### Fields inherited from class org.apache.cassandra.db.index.SecondaryIndex

      `baseCfs, columnDefs, CUSTOM_INDEX_OPTION_NAME, INDEX_ENTRIES_OPTION_NAME, INDEX_KEYS_OPTION_NAME, INDEX_VALUES_OPTION_NAME, keyComparator, logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositesIndexOnCollectionValue()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CellNameType` | `buildIndexComparator(CFMetaData baseMetadata, ColumnDefinition columnDef)`
    `CompositesIndex.IndexedEntry` | `decodeEntry(DecoratedKey indexedValue, Cell indexEntry)`
    `protected java.nio.ByteBuffer` | `getIndexedValue(java.nio.ByteBuffer rowKey, Cell cell)`
    `protected AbstractType<?>` | `getIndexKeyComparator()`
    `boolean` | `indexes(CellName name)` Returns true if the provided cell name is indexed by this secondary index.
    `boolean` | `isStale(CompositesIndex.IndexedEntry entry, ColumnFamily data, long now)`
    `protected Composite` | `makeIndexColumnPrefix(java.nio.ByteBuffer rowKey, Composite cellName)`
    `boolean` | `supportsOperator(Operator operator)` Returns true if the index supports lookups for the given operator, false otherwise.

    - ### Methods inherited from class org.apache.cassandra.db.index.composites.CompositesIndex

      `create, createSecondaryIndexSearcher, delete, getExpressionComparator, getIndexComparator, getIndexComparator, makeIndexColumnName, validateOptions`

    - ### Methods inherited from class org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex

      `delete, deleteForCleanup, estimateResultRows, expressionString, forceBlockingFlush, getIndexCfs, getIndexName, init, insert, invalidate, reload, removeIndex, truncateBlocking, update, validate`

    - ### Methods inherited from class org.apache.cassandra.db.index.PerColumnSecondaryIndex

      `getNameForSystemKeyspace, validate`

    - ### Methods inherited from class org.apache.cassandra.db.index.SecondaryIndex

      `buildIndexAsync, buildIndexBlocking, createInstance, getBaseCfs, getColumnDefs, getIndexKeyFor, indexes, isIndexBuilt, isQueryable, setIndexBuilt, setIndexRemoved, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CompositesIndexOnCollectionValue

          public CompositesIndexOnCollectionValue()

  - ### Method Detail

    - #### buildIndexComparator

          public static CellNameType buildIndexComparator(CFMetaData baseMetadata,
                                                          ColumnDefinition columnDef)

    - #### getIndexKeyComparator

          protected AbstractType<?> getIndexKeyComparator()

      Overrides:
        `getIndexKeyComparator` in class `AbstractSimplePerColumnSecondaryIndex`

    - #### getIndexedValue

          protected java.nio.ByteBuffer getIndexedValue(java.nio.ByteBuffer rowKey,
                                                        Cell cell)

      Specified by:
        `getIndexedValue` in class `AbstractSimplePerColumnSecondaryIndex`

    - #### makeIndexColumnPrefix

          protected Composite makeIndexColumnPrefix(java.nio.ByteBuffer rowKey,
                                                    Composite cellName)

      Specified by:
        `makeIndexColumnPrefix` in class `CompositesIndex`

    - #### decodeEntry

          public CompositesIndex.IndexedEntry decodeEntry(DecoratedKey indexedValue,
                                                          Cell indexEntry)

      Specified by:
        `decodeEntry` in class `CompositesIndex`

    - #### supportsOperator

          public boolean supportsOperator(Operator operator)

      Description copied from class: `SecondaryIndex`
      Returns true if the index supports lookups for the given operator, false otherwise.
      Overrides:
        `supportsOperator` in class `SecondaryIndex`

    - #### indexes

          public boolean indexes(CellName name)

      Description copied from class: `SecondaryIndex`
      Returns true if the provided cell name is indexed by this secondary index. The default implementation checks whether the name is one the columnDef name, but this should be overriden but subclass if needed.
      Specified by:
        `indexes` in class `SecondaryIndex`

    - #### isStale

          public boolean isStale(CompositesIndex.IndexedEntry entry,
                                 ColumnFamily data,
                                 long now)

      Specified by:
        `isStale` in class `CompositesIndex`

Copyright © 2018 The Apache Software Foundation