예제 #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);
 }