org.apache.cassandra.config

## Class Schema

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

-     public class Schema
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.UUID` | `emptyVersion`
    `static Schema` | `instance`
    `static int` | `NAME_LENGTH` longest permissible KS or CF name.
    `static com.google.common.collect.ImmutableSet<java.lang.String>` | `systemKeyspaceNames`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Schema()` Initialize empty schema object

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOldCfIdMapping(java.lang.Integer oldId, java.util.UUID newId)`
    `void` | `clear()` Clear all KS/CF metadata and reset version.
    `void` | `clearTableDefinition(KSMetaData ksm)` Remove table definition from system
    `java.lang.Integer` | `convertNewCfId(java.util.UUID newCfId)`
    `java.util.UUID` | `convertOldCfId(java.lang.Integer oldCfId)`
    `Pair<java.lang.String,java.lang.String>` | `getCF(java.util.UUID cfId)`
    `CFMetaData` | `getCFMetaData(Descriptor descriptor)`
    `CFMetaData` | `getCFMetaData(java.lang.String tableName, java.lang.String cfName)` Given a table name & column family name, get the column family meta data.
    `CFMetaData` | `getCFMetaData(java.util.UUID cfId)` Get ColumnFamily metadata by its identifier
    `ColumnFamilyType` | `getColumnFamilyType(java.lang.String ksName, java.lang.String cfName)` Get type of the ColumnFamily but it's keyspace/name
    `AbstractType<?>` | `getComparator(java.lang.String ksName, java.lang.String cfName)` Get column comparator for ColumnFamily but it's keyspace/name
    `java.util.UUID` | `getId(java.lang.String ksName, java.lang.String cfName)` Lookup keyspace/ColumnFamily identifier
    `KSMetaData` | `getKSMetaData(java.lang.String table)` Get metadata about table by its name
    `java.util.List<java.lang.String>` | `getNonSystemTables()`
    `AbstractType<?>` | `getSubComparator(java.lang.String ksName, java.lang.String cfName)` Get subComparator of the ColumnFamily
    `KSMetaData` | `getTableDefinition(java.lang.String table)` Get metadata about table by its name
    `java.util.Collection<KSMetaData>` | `getTableDefinitions()`
    `Table` | `getTableInstance(java.lang.String tableName)` Get table instance by name
    `java.util.Map<java.lang.String,CFMetaData>` | `getTableMetaData(java.lang.String tableName)` Get metadata about table inner ColumnFamilies
    `java.util.Set<java.lang.String>` | `getTables()`
    `AbstractType<?>` | `getValueValidator(java.lang.String ksName, java.lang.String cfName, java.nio.ByteBuffer column)` Get value validator for specific column
    `java.util.UUID` | `getVersion()`
    `static boolean` | `ignoredSchemaRow(Row row)`
    `static boolean` | `invalidSchemaRow(Row row)`
    `void` | `load(CFMetaData cfm)` Load individual ColumnFamily Definition to the schema (to make ColumnFamily lookup faster)
    `Schema` | `load(java.util.Collection<KSMetaData> tableDefs)` Load up non-system tables
    `Schema` | `load(KSMetaData keyspaceDef)` Load specific keyspace into Schema
    `void` | `purge(CFMetaData cfm)` Used for ColumnFamily data eviction out from the schema
    `Table` | `removeTableInstance(java.lang.String tableName)` Remove table from schema
    `void` | `setTableDefinition(KSMetaData ksm)` Update (or insert) new table definition
    `void` | `storeTableInstance(Table table)` Store given Table instance to the schema
    `void` | `updateVersion()` Read schema from system table and calculate MD5 digest of every row, resulting digest will be converted into UUID which would act as content-based version of the schema.
    `void` | `updateVersionAndAnnounce()`

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

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

- - ### Field Detail

    - #### instance

          public static final Schema instance

    - #### NAME_LENGTH

          public static final int NAME_LENGTH

      longest permissible KS or CF name. Our main concern is that filename not be more than 255 characters; the filename will contain both the KS and CF names. Since non-schema-name components only take up ~64 characters, we could allow longer names than this, but on Windows, the entire path should be not greater than 255 characters, so a lower limit here helps avoid problems. See CASSANDRA-4110.
      See Also:
        Constant Field Values

    - #### emptyVersion

          public static final java.util.UUID emptyVersion

    - #### systemKeyspaceNames

          public static final com.google.common.collect.ImmutableSet<java.lang.String> systemKeyspaceNames

  - ### Constructor Detail

    - #### Schema

          public Schema()

      Initialize empty schema object

  - ### Method Detail

    - #### load

          public Schema load(java.util.Collection<KSMetaData> tableDefs)

      Load up non-system tables
      Parameters:
        `tableDefs` - The non-system table definitions
      Returns:
        self to support chaining calls

    - #### load

          public Schema load(KSMetaData keyspaceDef)

      Load specific keyspace into Schema
      Parameters:
        `keyspaceDef` - The keyspace to load up
      Returns:
        self to support chaining calls

    - #### getTableInstance

          public Table getTableInstance(java.lang.String tableName)

      Get table instance by name
      Parameters:
        `tableName` - The name of the table
      Returns:
        Table object or null if table was not found

    - #### storeTableInstance

          public void storeTableInstance(Table table)

      Store given Table instance to the schema
      Parameters:
        `table` - The Table instance to store
      Throws:
        `java.lang.IllegalArgumentException` - if Table is already stored

    - #### removeTableInstance

          public Table removeTableInstance(java.lang.String tableName)

      Remove table from schema
      Parameters:
        `tableName` - The name of the table to remove
      Returns:
        removed table instance or null if it wasn't found

    - #### clearTableDefinition

          public void clearTableDefinition(KSMetaData ksm)

      Remove table definition from system
      Parameters:
        `ksm` - The table definition to remove

    - #### getCFMetaData

          public CFMetaData getCFMetaData(java.lang.String tableName,
                                 java.lang.String cfName)

      Given a table name & column family name, get the column family meta data. If the table name or column family name is not valid this function returns null.
      Parameters:
        `tableName` - The table name
        `cfName` - The ColumnFamily name
      Returns:
        ColumnFamily Metadata object or null if it wasn't found

    - #### getCFMetaData

          public CFMetaData getCFMetaData(java.util.UUID cfId)

      Get ColumnFamily metadata by its identifier
      Parameters:
        `cfId` - The ColumnFamily identifier
      Returns:
        metadata about ColumnFamily

    - #### getCFMetaData

          public CFMetaData getCFMetaData(Descriptor descriptor)

    - #### getColumnFamilyType

          public ColumnFamilyType getColumnFamilyType(java.lang.String ksName,
                                             java.lang.String cfName)

      Get type of the ColumnFamily but it's keyspace/name
      Parameters:
        `ksName` - The keyspace name
        `cfName` - The ColumnFamily name
      Returns:
        The type of the ColumnFamily

    - #### getComparator

          public AbstractType<?> getComparator(java.lang.String ksName,
                                      java.lang.String cfName)

      Get column comparator for ColumnFamily but it's keyspace/name
      Parameters:
        `ksName` - The keyspace name
        `cfName` - The ColumnFamily name
      Returns:
        The comparator of the ColumnFamily

    - #### getSubComparator

          public AbstractType<?> getSubComparator(java.lang.String ksName,
                                         java.lang.String cfName)

      Get subComparator of the ColumnFamily
      Parameters:
        `ksName` - The keyspace name
        `cfName` - The ColumnFamily name
      Returns:
        The subComparator of the ColumnFamily

    - #### getValueValidator

          public AbstractType<?> getValueValidator(java.lang.String ksName,
                                          java.lang.String cfName,
                                          java.nio.ByteBuffer column)

      Get value validator for specific column
      Parameters:
        `ksName` - The keyspace name
        `cfName` - The ColumnFamily name
        `column` - The name of the column
      Returns:
        value validator specific to the column or default (per-cf) one

    - #### getKSMetaData

          public KSMetaData getKSMetaData(java.lang.String table)

      Get metadata about table by its name
      Parameters:
        `table` - The name of the table
      Returns:
        The table metadata or null if it wasn't found

    - #### getNonSystemTables

          public java.util.List<java.lang.String> getNonSystemTables()

      Returns:
        collection of the non-system tables

    - #### getTableDefinition

          public KSMetaData getTableDefinition(java.lang.String table)

      Get metadata about table by its name
      Parameters:
        `table` - The name of the table
      Returns:
        The table metadata or null if it wasn't found

    - #### getTableMetaData

          public java.util.Map<java.lang.String,CFMetaData> getTableMetaData(java.lang.String tableName)

      Get metadata about table inner ColumnFamilies
      Parameters:
        `tableName` - The name of the table
      Returns:
        metadata about ColumnFamilies the belong to the given table

    - #### getTables

          public java.util.Set<java.lang.String> getTables()

      Returns:
        collection of the all table names registered in the system (system and non-system)

    - #### getTableDefinitions

          public java.util.Collection<KSMetaData> getTableDefinitions()

      Returns:
        collection of the metadata about all tables registered in the system (system and non-system)

    - #### setTableDefinition

          public void setTableDefinition(KSMetaData ksm)

      Update (or insert) new table definition
      Parameters:
        `ksm` - The metadata about table

    - #### addOldCfIdMapping

          public void addOldCfIdMapping(java.lang.Integer oldId,
                               java.util.UUID newId)

    - #### convertOldCfId

          public java.util.UUID convertOldCfId(java.lang.Integer oldCfId)
                                        throws UnknownColumnFamilyException

      Throws:
        `UnknownColumnFamilyException`

    - #### convertNewCfId

          public java.lang.Integer convertNewCfId(java.util.UUID newCfId)

    - #### getCF

          public Pair<java.lang.String,java.lang.String> getCF(java.util.UUID cfId)

      Parameters:
        `cfId` - The identifier of the ColumnFamily to lookup
      Returns:
        The (ksname,cfname) pair for the given id, or null if it has been dropped.

    - #### getId

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

      Lookup keyspace/ColumnFamily identifier
      Parameters:
        `ksName` - The keyspace name
        `cfName` - The ColumnFamily name
      Returns:
        The id for the given (ksname,cfname) pair, or null if it has been dropped.

    - #### load

          public void load(CFMetaData cfm)

      Load individual ColumnFamily Definition to the schema (to make ColumnFamily lookup faster)
      Parameters:
        `cfm` - The ColumnFamily definition to load

    - #### purge

          public void purge(CFMetaData cfm)

      Used for ColumnFamily data eviction out from the schema
      Parameters:
        `cfm` - The ColumnFamily Definition to evict

    - #### getVersion

          public java.util.UUID getVersion()

      Returns:
        current schema version

    - #### updateVersion

          public void updateVersion()

      Read schema from system table and calculate MD5 digest of every row, resulting digest will be converted into UUID which would act as content-based version of the schema.

    - #### updateVersionAndAnnounce

          public void updateVersionAndAnnounce()

    - #### clear

          public void clear()

      Clear all KS/CF metadata and reset version.

    - #### invalidSchemaRow

          public static boolean invalidSchemaRow(Row row)

    - #### ignoredSchemaRow

          public static boolean ignoredSchemaRow(Row row)

Copyright © 2014 The Apache Software Foundation