// converts CFM to avro CfDef
public org.apache.cassandra.db.migration.avro.CfDef toAvro()
{
org.apache.cassandra.db.migration.avro.CfDef cf = new org.apache.cassandra.db.migration.avro.CfDef();
cf.id = cfId;
cf.keyspace = new Utf8(ksName);
cf.name = new Utf8(cfName);
cf.column_type = new Utf8(cfType.name());
cf.comparator_type = new Utf8(comparator.toString());
if (subcolumnComparator != null)
{
assert cfType == ColumnFamilyType.Super
: String.format("%s CF %s should not have subcomparator %s defined", cfType, cfName, subcolumnComparator);
cf.subcomparator_type = new Utf8(subcolumnComparator.toString());
}
cf.comment = new Utf8(enforceCommentNotNull(comment));
cf.row_cache_size = rowCacheSize;
cf.key_cache_size = keyCacheSize;
cf.read_repair_chance = readRepairChance;
cf.replicate_on_write = replicateOnWrite;
cf.gc_grace_seconds = gcGraceSeconds;
cf.default_validation_class = defaultValidator == null ? null : new Utf8(defaultValidator.toString());
cf.key_validation_class = new Utf8(keyValidator.toString());
cf.min_compaction_threshold = minCompactionThreshold;
cf.max_compaction_threshold = maxCompactionThreshold;
cf.row_cache_save_period_in_seconds = rowCacheSavePeriodInSeconds;
cf.key_cache_save_period_in_seconds = keyCacheSavePeriodInSeconds;
cf.row_cache_keys_to_save = rowCacheKeysToSave;
cf.merge_shards_chance = mergeShardsChance;
cf.key_alias = keyAlias;
cf.column_metadata = new ArrayList<ColumnDef>(column_metadata.size());
for (ColumnDefinition cd : column_metadata.values())
cf.column_metadata.add(cd.toAvro());
cf.row_cache_provider = new Utf8(rowCacheProvider.getClass().getName());
cf.compaction_strategy = new Utf8(compactionStrategyClass.getName());
if (compactionStrategyOptions != null)
{
cf.compaction_strategy_options = new HashMap<CharSequence, CharSequence>();
for (Map.Entry<String, String> e : compactionStrategyOptions.entrySet())
cf.compaction_strategy_options.put(new Utf8(e.getKey()), new Utf8(e.getValue()));
}
cf.compression_options = compressionParameters.asAvroOptions();
return cf;
}