本文整理汇总了Java中org.apache.cassandra.Util.addMutation方法的典型用法代码示例。如果您正苦于以下问题:Java Util.addMutation方法的具体用法?Java Util.addMutation怎么用?Java Util.addMutation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.Util
的用法示例。
在下文中一共展示了Util.addMutation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRemoveSubColumn
import org.apache.cassandra.Util; //导入方法依赖的package包/类
@Test
public void testRemoveSubColumn()
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Super1");
Mutation rm;
DecoratedKey dk = Util.dk("key1");
// add data
rm = new Mutation("Keyspace1", dk.getKey());
Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
rm.apply();
store.forceBlockingFlush();
CellName cname = CellNames.compositeDense(ByteBufferUtil.bytes("SC1"), getBytes(1L));
// remove
rm = new Mutation("Keyspace1", dk.getKey());
rm.delete("Super1", cname, 1);
rm.apply();
ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, "Super1", System.currentTimeMillis()));
assertFalse(retrieved.getColumn(cname).isLive());
assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
}
示例2: testRemoveSubColumnAndContainer
import org.apache.cassandra.Util; //导入方法依赖的package包/类
@Test
public void testRemoveSubColumnAndContainer()
{
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Super1");
Mutation rm;
DecoratedKey dk = Util.dk("key2");
// add data
rm = new Mutation("Keyspace1", dk.getKey());
Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
rm.apply();
store.forceBlockingFlush();
// remove the SC
ByteBuffer scName = ByteBufferUtil.bytes("SC1");
CellName cname = CellNames.compositeDense(scName, getBytes(1L));
rm = new Mutation("Keyspace1", dk.getKey());
rm.deleteRange("Super1", SuperColumns.startOf(scName), SuperColumns.endOf(scName), 1);
rm.apply();
// Mark current time and make sure the next insert happens at least
// one second after the previous one (since gc resolution is the second)
QueryFilter filter = QueryFilter.getIdentityFilter(dk, "Super1", System.currentTimeMillis());
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
// remove the column itself
rm = new Mutation("Keyspace1", dk.getKey());
rm.delete("Super1", cname, 2);
rm.apply();
ColumnFamily retrieved = store.getColumnFamily(filter);
assertFalse(retrieved.getColumn(cname).isLive());
assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
}