当前位置: 首页>>代码示例>>Java>>正文


Java CellNames.fromAbstractType方法代码示例

本文整理汇总了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;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:AlterTypeStatement.java

示例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;
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:22,代码来源:AlterTypeStatement.java

示例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());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:58,代码来源:CreateColumnFamilyStatement.java

示例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));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:AbstractQueryPagerTest.java

示例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);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:6,代码来源:CFMetaData.java

示例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);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:6,代码来源:CFMetaData.java


注:本文中的org.apache.cassandra.db.composites.CellNames.fromAbstractType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。