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


Java CompositeType.Builder方法代码示例

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


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

示例1: fromSCNamesFilter

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public static IDiskAtomFilter fromSCNamesFilter(CompositeType type, ByteBuffer scName, NamesQueryFilter filter)
{
    if (scName == null)
    {
        ColumnSlice[] slices = new ColumnSlice[filter.columns.size()];
        int i = 0;
        for (ByteBuffer bb : filter.columns)
        {
            CompositeType.Builder builder = type.builder().add(bb);
            slices[i++] = new ColumnSlice(builder.build(), builder.buildAsEndOfRange());
        }
        return new SliceQueryFilter(slices, false, slices.length, 1);
    }
    else
    {
        SortedSet<ByteBuffer> newColumns = new TreeSet<ByteBuffer>(type);
        for (ByteBuffer c : filter.columns)
            newColumns.add(CompositeType.build(scName, c));
        return filter.withUpdatedColumns(newColumns);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:SuperColumns.java

示例2: byteBuffer

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
/**
 * Returns a {@link ByteBuffer} representing the specified clustering key
 *
 * @param clustering
 *            the clustering key
 * @return the byte buffer representing {@code clustering}
 */
public ByteBuffer byteBuffer(Clustering clustering) {
	CompositeType.Builder builder = type.builder();
	for (ByteBuffer component : clustering.getRawValues()) {
		builder.add(component);
	}
	return builder.build();
}
 
开发者ID:jmiddleton,项目名称:cassandra-fhir-index,代码行数:15,代码来源:KeyMapper.java

示例3: getKeyNameBuilder

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public ColumnNameBuilder getKeyNameBuilder()
{
    return hasCompositeKey
         ? new CompositeType.Builder((CompositeType)cfm.getKeyValidator())
         : new NonCompositeBuilder(cfm.getKeyValidator());
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:7,代码来源:CFDefinition.java

示例4: getColumnNameBuilder

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public ColumnNameBuilder getColumnNameBuilder()
{
    return isComposite
         ? new CompositeType.Builder((CompositeType)cfm.comparator)
         : new NonCompositeBuilder(cfm.comparator);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:7,代码来源:CFDefinition.java

示例5: testDeleteCompositeIndex

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
@Test
public void testDeleteCompositeIndex() throws Exception
{
    String keySpace = "Keyspace2";
    String cfName = "Indexed3"; // has gcGrace 0

    Keyspace keyspace = Keyspace.open(keySpace);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
    cfs.truncateBlocking();

    ByteBuffer rowKey = ByteBufferUtil.bytes("k1");
    ByteBuffer clusterKey = ByteBufferUtil.bytes("ck1");
    ByteBuffer colName = ByteBufferUtil.bytes("col1");
    CompositeType baseComparator = (CompositeType)cfs.getComparator();
    CompositeType.Builder builder = baseComparator.builder();
    builder.add(clusterKey);
    builder.add(colName);
    ByteBuffer compositeName = builder.build();

    ByteBuffer val1 = ByteBufferUtil.bytes("v2");

    // Insert indexed value.
    RowMutation rm;
    rm = new RowMutation(keySpace, rowKey);
    rm.add(cfName, compositeName, val1, 0);
    rm.apply();

    // Now delete the value and flush too.
    rm = new RowMutation(keySpace, rowKey);
    rm.delete(cfName, 1);
    rm.apply();

    // We want the data to be gcable, but even if gcGrace == 0, we still need to wait 1 second
    // since we won't gc on a tie.
    try { Thread.sleep(1000); } catch (Exception e) {}

    // Read the index and we check we do get no value (and no NPE)
    // Note: the index will return the entry because it hasn't been deleted (we
    /* haven't read yet nor compacted) but the data read itself will return null
    IndexExpression expr = new IndexExpression(colName, IndexOperator.EQ, val1);
    List<IndexExpression> clause = Arrays.asList(expr);
    IDiskAtomFilter filter = new IdentityQueryFilter();
    Range<RowPosition> range = Util.range("", "");
    List<Row> rows = keyspace.getColumnFamilyStore(cfName).search(range, clause, filter, 100);
    assertEquals(0, rows.size());
    */
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:48,代码来源:ColumnFamilyStoreTest.java


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