/** 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(); }
/** * 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; }
/** * 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(); }
/** * 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); }