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


Java CFMetaData.isCompound方法代码示例

本文整理汇总了Java中org.apache.cassandra.config.CFMetaData.isCompound方法的典型用法代码示例。如果您正苦于以下问题:Java CFMetaData.isCompound方法的具体用法?Java CFMetaData.isCompound怎么用?Java CFMetaData.isCompound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.config.CFMetaData的用法示例。


在下文中一共展示了CFMetaData.isCompound方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decodeClustering

import org.apache.cassandra.config.CFMetaData; //导入方法依赖的package包/类
public static Clustering decodeClustering(CFMetaData metadata, ByteBuffer value)
{
    int csize = metadata.comparator.size();
    if (csize == 0)
        return Clustering.EMPTY;

    if (metadata.isCompound() && CompositeType.isStaticName(value))
        return Clustering.STATIC_CLUSTERING;

    List<ByteBuffer> components = metadata.isCompound()
        ? CompositeType.splitName(value)
        : Collections.singletonList(value);

    return Clustering.make(components.subList(0, Math.min(csize, components.size())).toArray(new ByteBuffer[csize]));
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:16,代码来源:LegacyLayout.java

示例2: serialize

import org.apache.cassandra.config.CFMetaData; //导入方法依赖的package包/类
public void serialize(DataOutputPlus out, CFMetaData metadata) throws IOException
{
    out.writeInt(size);
    if (size == 0)
        return;

    if (metadata.isCompound())
        serializeCompound(out, metadata.isDense());
    else
        serializeSimple(out);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:12,代码来源:LegacyLayout.java

示例3: serializedSize

import org.apache.cassandra.config.CFMetaData; //导入方法依赖的package包/类
public long serializedSize(CFMetaData metadata)
{
    long size = 0;
    size += TypeSizes.sizeof(this.size);

    if (this.size == 0)
        return size;

    if (metadata.isCompound())
        return size + serializedSizeCompound(metadata.isDense());
    else
        return size + serializedSizeSimple();
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:14,代码来源:LegacyLayout.java

示例4: decodeCellName

import org.apache.cassandra.config.CFMetaData; //导入方法依赖的package包/类
public static LegacyCellName decodeCellName(CFMetaData metadata, ByteBuffer cellname, boolean readAllAsDynamic) throws UnknownColumnException
{
    Clustering clustering = decodeClustering(metadata, cellname);

    if (metadata.isSuper())
        return decodeForSuperColumn(metadata, clustering, CompositeType.extractComponent(cellname, 1));

    if (metadata.isDense() || (metadata.isCompactTable() && readAllAsDynamic))
        return new LegacyCellName(clustering, metadata.compactValueColumn(), null);

    ByteBuffer column = metadata.isCompound() ? CompositeType.extractComponent(cellname, metadata.comparator.size()) : cellname;
    if (column == null)
    {
        // Tables for composite 2ndary indexes used to be compound but dense, but we've transformed them into regular tables
        // (non compact ones) but with no regular column (i.e. we only care about the clustering). So we'll get here
        // in that case, and what we want to return is basically a row marker.
        if (metadata.partitionColumns().isEmpty())
            return new LegacyCellName(clustering, null, null);

        // Otherwise, we shouldn't get there
        throw new IllegalArgumentException("No column name component found in cell name");
    }

    // Row marker, this is ok
    if (!column.hasRemaining())
        return new LegacyCellName(clustering, null, null);

    ColumnDefinition def = metadata.getColumnDefinition(column);
    if ((def == null) || def.isPrimaryKeyColumn())
    {
        // If it's a compact table, it means the column is in fact a "dynamic" one
        if (metadata.isCompactTable())
            return new LegacyCellName(Clustering.make(column), metadata.compactValueColumn(), null);

        if (def == null)
            throw new UnknownColumnException(metadata, column);
        else
            throw new IllegalArgumentException("Cannot add primary key column to partition update");
    }

    ByteBuffer collectionElement = metadata.isCompound() ? CompositeType.extractComponent(cellname, metadata.comparator.size() + 1) : null;

    // Note that because static compact columns are translated to static defs in the new world order, we need to force a static
    // clustering if the definition is static (as it might not be in this case).
    return new LegacyCellName(def.isStatic() ? Clustering.STATIC_CLUSTERING : clustering, def, collectionElement);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:47,代码来源:LegacyLayout.java


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