示例#1
0
  /** Clear all KS/CF metadata and reset version. */
  public synchronized void clear() {
    for (String table : getNonSystemTables()) {
      KSMetaData ksm = getTableDefinition(table);
      for (CFMetaData cfm : ksm.cfMetaData().values()) purge(cfm);
      clearTableDefinition(ksm);
    }

    updateVersionAndAnnounce();
  }
示例#2
0
  /**
   * Load specific keyspace into Schema
   *
   * @param keyspaceDef The keyspace to load up
   * @return self to support chaining calls
   */
  public Schema load(KSMetaData keyspaceDef) {
    for (CFMetaData cfm : keyspaceDef.cfMetaData().values()) load(cfm);

    setTableDefinition(keyspaceDef);

    return this;
  }
示例#3
0
 /**
  * Get metadata about table inner ColumnFamilies
  *
  * @param tableName The name of the table
  * @return metadata about ColumnFamilies the belong to the given table
  */
 public Map<String, CFMetaData> getTableMetaData(String tableName) {
   assert tableName != null;
   KSMetaData ksm = tables.get(tableName);
   assert ksm != null;
   return ksm.cfMetaData();
 }
示例#4
0
 /**
  * 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.
  *
  * @param tableName The table name
  * @param cfName The ColumnFamily name
  * @return ColumnFamily Metadata object or null if it wasn't found
  */
 public CFMetaData getCFMetaData(String tableName, String cfName) {
   assert tableName != null;
   KSMetaData ksm = tables.get(tableName);
   return (ksm == null) ? null : ksm.cfMetaData().get(cfName);
 }
示例#5
0
 public RowMutation toSchemaUpdate(KSMetaData newState, long modificationTimestamp) {
   return newState.toSchema(modificationTimestamp);
 }