本文整理汇总了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);
}
}
示例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();
}
示例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());
}
示例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);
}
示例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());
*/
}