org.apache.cassandra.config

## Class CFMetaData

- java.lang.Object
- - org.apache.cassandra.config.CFMetaData

    public final class CFMetaData
    extends java.lang.Object

This class can be tricky to modify. Please read http://wiki.apache.org/cassandra/ConfigurationNotes for how to do so safely.

### Nested Class Summary

Nested Classes
`static class` `CFMetaData.Builder`
`static class` `CFMetaData.DroppedColumn`
`static class` `CFMetaData.Flag`
`static class` `CFMetaData.Serializer`

### Field Summary

Fields
`java.util.UUID` `cfId`
`java.lang.String` `cfName`
`ClusteringComparator` `comparator`
`byte[]` `ksAndCFBytes`
`Pair<java.lang.String,java.lang.String>` `ksAndCFName`
`java.lang.String` `ksName`
`TableParams` `params`
`IPartitioner` `partitioner`
`DataResource` `resource`
`static CFMetaData.Serializer` `serializer`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`CFMetaData` `addColumnDefinition(ColumnDefinition def)`
`CFMetaData` `addOrReplaceColumnDefinition(ColumnDefinition def)`
`java.util.Collection<ColumnDefinition>` `allColumns()`
`java.util.Iterator<ColumnDefinition>` `allColumnsInSelectOrder()`
`boolean` `apply(CFMetaData cfm)` Updates CFMetaData in-place to match cfm
`CFMetaData` `asNonCompact()` Returns a cached non-compact version of this table.
`CFMetaData` `bloomFilterFpChance(double prop)`
`CFMetaData` `caching(CachingParams prop)`
`java.util.List<ColumnDefinition>` `clusteringColumns()`
`CFMetaData` `comment(java.lang.String prop)`
`CFMetaData` `compaction(CompactionParams prop)`
`ColumnDefinition` `compactValueColumn()`
`static CFMetaData` `compile(java.lang.String cql, java.lang.String keyspace)`
`CFMetaData` `compression(CompressionParams prop)`
`CFMetaData` `copy()`
`CFMetaData` `copy(IPartitioner partitioner)`
`CFMetaData` `copy(java.util.UUID newCfId)` Clones the CFMetaData, but sets a different cfId
`static CFMetaData` `copyOpts(CFMetaData newCFMD, CFMetaData oldCFMD)`
`CFMetaData` `crcCheckChance(double prop)`
`static CFMetaData` `create(java.lang.String ksName, java.lang.String name, java.util.UUID cfId, boolean isDense, boolean isCompound, boolean isSuper, boolean isCounter, boolean isView, java.util.List<ColumnDefinition> columns, IPartitioner partitioner)`
`static java.lang.Class<? extends AbstractCompactionStrategy>` `createCompactionStrategy(java.lang.String className)`
`static AbstractCompactionStrategy` `createCompactionStrategyInstance(ColumnFamilyStore cfs, CompactionParams compactionParams)`
`static CFMetaData` `createFake(java.lang.String keyspace, java.lang.String name)` There is a couple of places in the code where we need a CFMetaData object and don't have one readily available and know that only the keyspace and name matter.
`CFMetaData` `dcLocalReadRepairChance(double prop)`
`DecoratedKey` `decorateKey(java.nio.ByteBuffer key)`
`CFMetaData` `defaultTimeToLive(int prop)`
`CFMetaData` `droppedColumns(java.util.Map<java.nio.ByteBuffer,CFMetaData.DroppedColumn> cols)`
`boolean` `enforceStrictLiveness()` A table with strict liveness filters/ignores rows without PK liveness info, effectively tying the row liveness to its primary key liveness.
`boolean` `equals(java.lang.Object o)`
`CFMetaData` `extensions(java.util.Map<java.lang.String,java.nio.ByteBuffer> extensions)`
`static java.util.List<AbstractType<?>>` `extractTypes(java.lang.Iterable<ColumnDefinition> clusteringColumns)`
`java.util.Set<CFMetaData.Flag>` `flags()`
`static java.util.Set<CFMetaData.Flag>` `flagsFromStrings(java.util.Set<java.lang.String> strings)`
`static java.util.Set<java.lang.String>` `flagsToStrings(java.util.Set<CFMetaData.Flag> flags)`
`CFMetaData` `gcGraceSeconds(int prop)`
`static java.util.UUID` `generateLegacyCfId(java.lang.String ksName, java.lang.String cfName)` Generates deterministic UUID from keyspace/columnfamily name pair.
`ColumnFilter` `getAllColumnFilter()`
`ColumnDefinition` `getColumnDefinition(java.nio.ByteBuffer name)`
`ColumnDefinition` `getColumnDefinition(ColumnIdentifier name)` Returns the ColumnDefinition for `name`.
`AbstractType<?>` `getColumnDefinitionNameComparator(ColumnDefinition.Kind kind)`
`java.util.Map<java.nio.ByteBuffer,ColumnDefinition>` `getColumnMetadata()`
`ColumnDefinition` `getDroppedColumnDefinition(java.nio.ByteBuffer name)`
`ColumnDefinition` `getDroppedColumnDefinition(java.nio.ByteBuffer name, boolean isStatic)` Returns a "fake" ColumnDefinition corresponding to the dropped column `name` of `null` if there is no such dropped column.
`java.util.Map<java.nio.ByteBuffer,CFMetaData.DroppedColumn>` `getDroppedColumns()`
`Indexes` `getIndexes()`
`AbstractType<?>` `getKeyValidator()`
`ClusteringComparator` `getKeyValidatorAsClusteringComparator()`
`java.lang.String` `getParentColumnFamilyName()`
`Triggers` `getTriggers()`
`boolean` `hasCollectionColumns()`
`boolean` `hasComplexColumns()`
`boolean` `hasDroppedCollectionColumns()`
`int` `hashCode()`
`boolean` `hasStaticColumns()`
`java.lang.String` `indexColumnFamilyName(IndexMetadata info)` generate a column family name for an index corresponding to the given column.
`CFMetaData` `indexes(Indexes indexes)`
`boolean` `isCompactTable()`
`boolean` `isCompound()`
`boolean` `isCounter()`
`boolean` `isCQLTable()`
`boolean` `isDense()`
`boolean` `isIndex()` true if this CFS contains secondary index data.
`static boolean` `isNameValid(java.lang.String name)`
`boolean` `isStaticCompactTable()`
`boolean` `isSuper()`
`boolean` `isSuperColumnKeyColumn(ColumnDefinition cd)`
`boolean` `isSuperColumnValueColumn(ColumnDefinition cd)`
`boolean` `isThriftCompatible()` Returns whether this CFMetaData can be returned to thrift.
`boolean` `isView()`
`AbstractType<?>` `makeLegacyDefaultValidator()`
`CFMetaData` `maxIndexInterval(int prop)`
`CFMetaData` `memtableFlushPeriod(int prop)`
`CFMetaData` `minIndexInterval(int prop)`
`ReadRepairDecision` `newReadRepairDecision()`
`CFMetaData` `params(TableParams params)`
`PartitionColumns` `partitionColumns()`
`java.util.List<ColumnDefinition>` `partitionKeyColumns()`
`java.lang.Iterable<ColumnDefinition>` `primaryKeyColumns()`
`CFMetaData` `readRepairChance(double prop)`
`void` `recordColumnDrop(ColumnDefinition def, long timeMicros)` Adds the column definition as a dropped column, recording the drop with the provided timestamp.
`CFMetaData` `reloadIndexMetadataProperties(CFMetaData parent)`
`boolean` `removeColumnDefinition(ColumnDefinition def)`
`void` `renameColumn(ColumnIdentifier from, ColumnIdentifier to)`
`static java.nio.ByteBuffer` `serializePartitionKey(ClusteringPrefix keyAsClustering)`
`Serializers` `serializers()`
`CFMetaData` `speculativeRetry(SpeculativeRetryParam prop)`
`ColumnDefinition` `superColumnKeyColumn()`
`ColumnDefinition` `superColumnValueColumn()`
`AbstractType<?>` `thriftColumnNameType()`
`java.lang.String` `toString()`
`CFMetaData` `triggers(Triggers prop)`
`CFMetaData` `validate()`
`void` `validateCompatibility(CFMetaData cfm)`

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

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

### Field Detail

#### serializer

    public static final CFMetaData.Serializer serializer

#### cfId

    public final java.util.UUID cfId

#### ksName

    public final java.lang.String ksName

#### cfName

    public final java.lang.String cfName

#### ksAndCFName

    public final Pair<java.lang.String,java.lang.String> ksAndCFName

#### ksAndCFBytes

    public final byte[] ksAndCFBytes

#### comparator

    public volatile ClusteringComparator comparator

#### partitioner

    public final IPartitioner partitioner

#### params

    public volatile TableParams params

#### resource

    public final DataResource resource

### Method Detail

#### isSuperColumnKeyColumn

    public boolean isSuperColumnKeyColumn(ColumnDefinition cd)

#### isSuperColumnValueColumn

    public boolean isSuperColumnValueColumn(ColumnDefinition cd)

#### superColumnValueColumn

    public ColumnDefinition superColumnValueColumn()

#### superColumnKeyColumn

    public ColumnDefinition superColumnKeyColumn()

#### params

    public CFMetaData params(TableParams params)

#### bloomFilterFpChance

    public CFMetaData bloomFilterFpChance(double prop)

#### caching

    public CFMetaData caching(CachingParams prop)

#### comment

    public CFMetaData comment(java.lang.String prop)

#### compaction

    public CFMetaData compaction(CompactionParams prop)

#### compression

    public CFMetaData compression(CompressionParams prop)

#### dcLocalReadRepairChance

    public CFMetaData dcLocalReadRepairChance(double prop)

#### defaultTimeToLive

    public CFMetaData defaultTimeToLive(int prop)

#### gcGraceSeconds

    public CFMetaData gcGraceSeconds(int prop)

#### maxIndexInterval

    public CFMetaData maxIndexInterval(int prop)

#### memtableFlushPeriod

    public CFMetaData memtableFlushPeriod(int prop)

#### minIndexInterval

    public CFMetaData minIndexInterval(int prop)

#### readRepairChance

    public CFMetaData readRepairChance(double prop)

#### crcCheckChance

    public CFMetaData crcCheckChance(double prop)

#### speculativeRetry

    public CFMetaData speculativeRetry(SpeculativeRetryParam prop)

#### extensions

    public CFMetaData extensions(java.util.Map<java.lang.String,java.nio.ByteBuffer> extensions)

#### droppedColumns

    public CFMetaData droppedColumns(java.util.Map<java.nio.ByteBuffer,CFMetaData.DroppedColumn> cols)

#### triggers

    public CFMetaData triggers(Triggers prop)

#### indexes

    public CFMetaData indexes(Indexes indexes)

#### getIndexes

    public Indexes getIndexes()

#### getAllColumnFilter

    public ColumnFilter getAllColumnFilter()

#### create

    public static CFMetaData create(java.lang.String ksName,
                                    java.lang.String name,
                                    java.util.UUID cfId,
                                    boolean isDense,
                                    boolean isCompound,
                                    boolean isSuper,
                                    boolean isCounter,
                                    boolean isView,
                                    java.util.List<ColumnDefinition> columns,
                                    IPartitioner partitioner)

#### extractTypes

    public static java.util.List<AbstractType<?>> extractTypes(java.lang.Iterable<ColumnDefinition> clusteringColumns)

#### flags

    public java.util.Set<CFMetaData.Flag> flags()

#### createFake

    public static CFMetaData createFake(java.lang.String keyspace,
                                        java.lang.String name)

There is a couple of places in the code where we need a CFMetaData object and don't have one readily available and know that only the keyspace and name matter. This creates such "fake" metadata. Use only if you know what you're doing.

#### getTriggers

    public Triggers getTriggers()

#### compile

    public static CFMetaData compile(java.lang.String cql,
                                     java.lang.String keyspace)

#### generateLegacyCfId

    public static java.util.UUID generateLegacyCfId(java.lang.String ksName,
                                                    java.lang.String cfName)

Generates deterministic UUID from keyspace/columnfamily name pair. This is used to generate the same UUID for `C* version < 2.1` Since 2.1, this is only used for system columnfamilies and tests.

#### reloadIndexMetadataProperties

    public CFMetaData reloadIndexMetadataProperties(CFMetaData parent)

#### asNonCompact

    public CFMetaData asNonCompact()

Returns a cached non-compact version of this table. Cached version has to be invalidated every time the table is rebuilt.

#### copy

    public CFMetaData copy()

#### copy

    public CFMetaData copy(java.util.UUID newCfId)

Clones the CFMetaData, but sets a different cfId

Parameters:
  `newCfId` - the cfId for the cloned CFMetaData
Returns:
  the cloned CFMetaData instance with the new cfId

#### copy

    public CFMetaData copy(IPartitioner partitioner)

#### copyOpts

    public static CFMetaData copyOpts(CFMetaData newCFMD,
                                      CFMetaData oldCFMD)

#### indexColumnFamilyName

    public java.lang.String indexColumnFamilyName(IndexMetadata info)

generate a column family name for an index corresponding to the given column. This is NOT the same as the index's name! This is only used in sstable filenames and is not exposed to users.

Parameters:
  `info` - A definition of the column with index
Returns:
  name of the index ColumnFamily

#### isIndex

    public boolean isIndex()

true if this CFS contains secondary index data.

#### decorateKey

    public DecoratedKey decorateKey(java.nio.ByteBuffer key)

#### getColumnMetadata

    public java.util.Map<java.nio.ByteBuffer,ColumnDefinition> getColumnMetadata()

#### getParentColumnFamilyName

    public java.lang.String getParentColumnFamilyName()

Returns:
  The name of the parent cf if this is a seconday index

#### newReadRepairDecision

    public ReadRepairDecision newReadRepairDecision()

#### getColumnDefinitionNameComparator

    public AbstractType<?> getColumnDefinitionNameComparator(ColumnDefinition.Kind kind)

#### getKeyValidator

    public AbstractType<?> getKeyValidator()

#### allColumns

    public java.util.Collection<ColumnDefinition> allColumns()

#### allColumnsInSelectOrder

    public java.util.Iterator<ColumnDefinition> allColumnsInSelectOrder()

#### primaryKeyColumns

    public java.lang.Iterable<ColumnDefinition> primaryKeyColumns()

#### partitionKeyColumns

    public java.util.List<ColumnDefinition> partitionKeyColumns()

#### clusteringColumns

    public java.util.List<ColumnDefinition> clusteringColumns()

#### partitionColumns

    public PartitionColumns partitionColumns()

#### compactValueColumn

    public ColumnDefinition compactValueColumn()

#### getKeyValidatorAsClusteringComparator

    public ClusteringComparator getKeyValidatorAsClusteringComparator()

#### serializePartitionKey

    public static java.nio.ByteBuffer serializePartitionKey(ClusteringPrefix keyAsClustering)

#### getDroppedColumns

    public java.util.Map<java.nio.ByteBuffer,CFMetaData.DroppedColumn> getDroppedColumns()

#### getDroppedColumnDefinition

    public ColumnDefinition getDroppedColumnDefinition(java.nio.ByteBuffer name)

#### getDroppedColumnDefinition

    public ColumnDefinition getDroppedColumnDefinition(java.nio.ByteBuffer name,
                                                       boolean isStatic)

Returns a "fake" ColumnDefinition corresponding to the dropped column `name` of `null` if there is no such dropped column.

Parameters:
  `name` - - the column name
  `isStatic` - - whether the column was a static column, if known

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `java.lang.Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### apply

    public boolean apply(CFMetaData cfm)
                  throws ConfigurationException

Updates CFMetaData in-place to match cfm

Returns:
  true if any change was made which impacts queries/updates on the table, e.g. any columns or indexes were added, removed, or altered; otherwise, false is returned. Used to determine whether prepared statements against this table need to be re-prepared.
Throws:
  `ConfigurationException` - if ks/cf names or cf ids didn't match

#### validateCompatibility

    public void validateCompatibility(CFMetaData cfm)
                               throws ConfigurationException

Throws:
  `ConfigurationException`

#### createCompactionStrategy

    public static java.lang.Class<? extends AbstractCompactionStrategy> createCompactionStrategy(java.lang.String className)
                                                                                          throws ConfigurationException

Throws:
  `ConfigurationException`

#### createCompactionStrategyInstance

    public static AbstractCompactionStrategy createCompactionStrategyInstance(ColumnFamilyStore cfs,
                                                                              CompactionParams compactionParams)

#### getColumnDefinition

    public ColumnDefinition getColumnDefinition(ColumnIdentifier name)

Returns the ColumnDefinition for `name`.

#### getColumnDefinition

    public ColumnDefinition getColumnDefinition(java.nio.ByteBuffer name)

#### isNameValid

    public static boolean isNameValid(java.lang.String name)

#### validate

    public CFMetaData validate()
                        throws ConfigurationException

Throws:
  `ConfigurationException`

#### thriftColumnNameType

    public AbstractType<?> thriftColumnNameType()

#### addColumnDefinition

    public CFMetaData addColumnDefinition(ColumnDefinition def)
                                   throws ConfigurationException

Throws:
  `ConfigurationException`

#### addOrReplaceColumnDefinition

    public CFMetaData addOrReplaceColumnDefinition(ColumnDefinition def)

#### removeColumnDefinition

    public boolean removeColumnDefinition(ColumnDefinition def)

#### recordColumnDrop

    public void recordColumnDrop(ColumnDefinition def,
                                 long timeMicros)

Adds the column definition as a dropped column, recording the drop with the provided timestamp.

#### renameColumn

    public void renameColumn(ColumnIdentifier from,
                             ColumnIdentifier to)
                      throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### isCQLTable

    public boolean isCQLTable()

#### isCompactTable

    public boolean isCompactTable()

#### isStaticCompactTable

    public boolean isStaticCompactTable()

#### isThriftCompatible

    public boolean isThriftCompatible()

Returns whether this CFMetaData can be returned to thrift.

#### hasStaticColumns

    public boolean hasStaticColumns()

#### hasCollectionColumns

    public boolean hasCollectionColumns()

#### hasComplexColumns

    public boolean hasComplexColumns()

#### hasDroppedCollectionColumns

    public boolean hasDroppedCollectionColumns()

#### isSuper

    public boolean isSuper()

#### isCounter

    public boolean isCounter()

#### isDense

    public boolean isDense()

#### isCompound

    public boolean isCompound()

#### isView

    public boolean isView()

#### enforceStrictLiveness

    public boolean enforceStrictLiveness()

A table with strict liveness filters/ignores rows without PK liveness info, effectively tying the row liveness to its primary key liveness. Currently this is only used by views with normal base column as PK column so updates to other columns do not make the row live when the base column is not live. See CASSANDRA-11500.

#### serializers

    public Serializers serializers()

#### makeLegacyDefaultValidator

    public AbstractType<?> makeLegacyDefaultValidator()

#### flagsFromStrings

    public static java.util.Set<CFMetaData.Flag> flagsFromStrings(java.util.Set<java.lang.String> strings)

#### flagsToStrings

    public static java.util.Set<java.lang.String> flagsToStrings(java.util.Set<CFMetaData.Flag> flags)

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`