本文整理汇总了Java中org.apache.cassandra.db.composites.CellNames.fromAbstractType方法的典型用法代码示例。如果您正苦于以下问题:Java CellNames.fromAbstractType方法的具体用法?Java CellNames.fromAbstractType怎么用?Java CellNames.fromAbstractType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.composites.CellNames
的用法示例。
在下文中一共展示了CellNames.fromAbstractType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDefinition
import org.apache.cassandra.db.composites.CellNames; //导入方法依赖的package包/类
private boolean updateDefinition(CFMetaData cfm, ColumnDefinition def, String keyspace, ByteBuffer toReplace, UserType updated)
{
AbstractType<?> t = updateWith(def.type, keyspace, toReplace, updated);
if (t == null)
return false;
// We need to update this validator ...
cfm.addOrReplaceColumnDefinition(def.withNewType(t));
// ... but if it's part of the comparator or key validator, we need to go update those too.
switch (def.kind)
{
case PARTITION_KEY:
cfm.keyValidator(updateWith(cfm.getKeyValidator(), keyspace, toReplace, updated));
break;
case CLUSTERING_COLUMN:
cfm.comparator = CellNames.fromAbstractType(updateWith(cfm.comparator.asAbstractType(), keyspace, toReplace, updated), cfm.comparator.isDense());
break;
default:
// If it's a collection, we still want to modify the comparator because the collection is aliased in it
if (def.type instanceof CollectionType)
cfm.comparator = CellNames.fromAbstractType(updateWith(cfm.comparator.asAbstractType(), keyspace, toReplace, updated), cfm.comparator.isDense());
}
return true;
}
示例2: updateDefinition
import org.apache.cassandra.db.composites.CellNames; //导入方法依赖的package包/类
private boolean updateDefinition(CFMetaData cfm, ColumnDefinition def, String keyspace, ByteBuffer toReplace, UserType updated)
{
AbstractType<?> t = updateWith(def.type, keyspace, toReplace, updated);
if (t == null)
return false;
// We need to update this validator ...
cfm.addOrReplaceColumnDefinition(def.withNewType(t));
// ... but if it's part of the comparator or key validator, we need to go update those too.
switch (def.kind)
{
case PARTITION_KEY:
cfm.keyValidator(updateWith(cfm.getKeyValidator(), keyspace, toReplace, updated));
break;
case CLUSTERING_COLUMN:
cfm.comparator = CellNames.fromAbstractType(updateWith(cfm.comparator.asAbstractType(), keyspace, toReplace, updated), cfm.comparator.isDense());
break;
}
return true;
}
示例3: getCFMetaData
import org.apache.cassandra.db.composites.CellNames; //导入方法依赖的package包/类
/**
* Returns a CFMetaData instance based on the parameters parsed from this
* <code>CREATE</code> statement, or defaults where applicable.
*
* @param keyspace keyspace to apply this column family to
* @return a CFMetaData instance corresponding to the values parsed from this statement
* @throws InvalidRequestException on failure to validate parsed parameters
*/
public CFMetaData getCFMetaData(String keyspace, List<ByteBuffer> variables) throws InvalidRequestException
{
validate(variables);
try
{
boolean isDense = columns.isEmpty();
CFMetaData newCFMD = new CFMetaData(keyspace,
name,
ColumnFamilyType.Standard,
CellNames.fromAbstractType(cfProps.getComparator(), isDense));
if (CFMetaData.DEFAULT_COMPRESSOR != null && cfProps.compressionParameters.isEmpty())
cfProps.compressionParameters.put(CompressionParameters.SSTABLE_COMPRESSION, CFMetaData.DEFAULT_COMPRESSOR);
int maxCompactionThreshold = getPropertyInt(CFPropDefs.KW_MAXCOMPACTIONTHRESHOLD, CFMetaData.DEFAULT_MAX_COMPACTION_THRESHOLD);
int minCompactionThreshold = getPropertyInt(CFPropDefs.KW_MINCOMPACTIONTHRESHOLD, CFMetaData.DEFAULT_MIN_COMPACTION_THRESHOLD);
if (minCompactionThreshold <= 0 || maxCompactionThreshold <= 0)
throw new ConfigurationException("Disabling compaction by setting compaction thresholds to 0 has been deprecated, set the compaction option 'enabled' to false instead.");
newCFMD.isDense(isDense)
.addAllColumnDefinitions(getColumns(newCFMD))
.comment(cfProps.getProperty(CFPropDefs.KW_COMMENT))
.readRepairChance(getPropertyDouble(CFPropDefs.KW_READREPAIRCHANCE, CFMetaData.DEFAULT_READ_REPAIR_CHANCE))
.dcLocalReadRepairChance(getPropertyDouble(CFPropDefs.KW_DCLOCALREADREPAIRCHANCE, CFMetaData.DEFAULT_DCLOCAL_READ_REPAIR_CHANCE))
.gcGraceSeconds(getPropertyInt(CFPropDefs.KW_GCGRACESECONDS, CFMetaData.DEFAULT_GC_GRACE_SECONDS))
.defaultValidator(cfProps.getValidator())
.minCompactionThreshold(minCompactionThreshold)
.maxCompactionThreshold(maxCompactionThreshold)
.keyValidator(TypeParser.parse(CFPropDefs.comparators.get(getKeyType())))
.compactionStrategyClass(cfProps.compactionStrategyClass)
.compactionStrategyOptions(cfProps.compactionStrategyOptions)
.compressionParameters(CompressionParameters.create(cfProps.compressionParameters))
.caching(CachingOptions.fromString(getPropertyString(CFPropDefs.KW_CACHING, CFMetaData.DEFAULT_CACHING_STRATEGY.toString())))
.speculativeRetry(CFMetaData.SpeculativeRetry.fromString(getPropertyString(CFPropDefs.KW_SPECULATIVE_RETRY, CFMetaData.DEFAULT_SPECULATIVE_RETRY.toString())))
.bloomFilterFpChance(getPropertyDouble(CFPropDefs.KW_BF_FP_CHANCE, null))
.memtableFlushPeriod(getPropertyInt(CFPropDefs.KW_MEMTABLE_FLUSH_PERIOD, 0))
.defaultTimeToLive(getPropertyInt(CFPropDefs.KW_DEFAULT_TIME_TO_LIVE, CFMetaData.DEFAULT_DEFAULT_TIME_TO_LIVE));
// CQL2 can have null keyAliases
if (keyAlias != null)
newCFMD.addColumnDefinition(ColumnDefinition.partitionKeyDef(newCFMD, keyAlias, newCFMD.getKeyValidator(), null));
return newCFMD.rebuild();
}
catch (ConfigurationException | SyntaxException e)
{
throw new InvalidRequestException(e.toString());
}
}
示例4: createMetadata
import org.apache.cassandra.db.composites.CellNames; //导入方法依赖的package包/类
private CFMetaData createMetadata()
{
return new CFMetaData("ks", "cf", ColumnFamilyType.Standard, CellNames.fromAbstractType(Int32Type.instance, false));
}
示例5: denseCFMetaData
import org.apache.cassandra.db.composites.CellNames; //导入方法依赖的package包/类
public static CFMetaData denseCFMetaData(String keyspace, String name, AbstractType<?> comp, AbstractType<?> subcc)
{
CellNameType cellNameType = CellNames.fromAbstractType(makeRawAbstractType(comp, subcc), true);
return new CFMetaData(keyspace, name, subcc == null ? ColumnFamilyType.Standard : ColumnFamilyType.Super, cellNameType);
}
示例6: sparseCFMetaData
import org.apache.cassandra.db.composites.CellNames; //导入方法依赖的package包/类
public static CFMetaData sparseCFMetaData(String keyspace, String name, AbstractType<?> comp)
{
CellNameType cellNameType = CellNames.fromAbstractType(comp, false);
return new CFMetaData(keyspace, name, ColumnFamilyType.Standard, cellNameType);
}