KSMetaData( String name, Class<? extends AbstractReplicationStrategy> strategyClass, Map<String, String> strategyOptions, boolean durableWrites, Iterable<CFMetaData> cfDefs) { this.name = name; this.strategyClass = strategyClass == null ? NetworkTopologyStrategy.class : strategyClass; this.strategyOptions = strategyOptions; Map<String, CFMetaData> cfmap = new HashMap<String, CFMetaData>(); for (CFMetaData cfm : cfDefs) cfmap.put(cfm.cfName, cfm); this.cfMetaData = Collections.unmodifiableMap(cfmap); this.durableWrites = durableWrites; }
/** * Deserialize ColumnFamilies from low-level schema representation, all of them belong to the same * keyspace * * @param row * @return map containing name of the ColumnFamily and it's metadata for faster lookup */ public static Map<String, CFMetaData> deserializeColumnFamilies(Row row) { if (row.cf == null) return Collections.emptyMap(); Map<String, CFMetaData> cfms = new HashMap<String, CFMetaData>(); UntypedResultSet results = QueryProcessor.resultify("SELECT * FROM system.schema_columnfamilies", row); for (UntypedResultSet.Row result : results) { CFMetaData cfm = CFMetaData.fromSchema(result); cfms.put(cfm.cfName, cfm); } for (CFMetaData cfm : cfms.values()) { Row columnRow = ColumnDefinition.readSchema(cfm.ksName, cfm.cfName); for (ColumnDefinition cd : ColumnDefinition.fromSchema(columnRow, cfm)) cfm.column_metadata.put(cd.name, cd); } return cfms; }
public static Map<String, String> optsWithRF(final Integer rf) { Map<String, String> ret = new HashMap<String, String>(); ret.put("replication_factor", rf.toString()); return ret; }