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


Java Util.addMutation方法代码示例

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

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


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