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


Java KCVEntryMutation类代码示例

本文整理汇总了Java中com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation的典型用法代码示例。如果您正苦于以下问题:Java KCVEntryMutation类的具体用法?Java KCVEntryMutation怎么用?Java KCVEntryMutation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KCVEntryMutation类属于com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache包,在下文中一共展示了KCVEntryMutation类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mutateManyStressTest

import com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation; //导入依赖的package包/类
@Test
public void mutateManyStressTest() throws BackendException {

    Map<StaticBuffer, Map<StaticBuffer, StaticBuffer>> state =
            new HashMap<StaticBuffer, Map<StaticBuffer, StaticBuffer>>();

    int dels = 1024;
    int adds = 4096;

    for (int round = 0; round < 5; round++) {
        Map<StaticBuffer, KCVEntryMutation> changes = mutateState(state, dels, adds);

        applyChanges(changes, store1, tx);
        applyChanges(changes, store2, tx);
        newTx();

        int deletesExpected = 0 == round ? 0 : dels;

        int stateSizeExpected = adds + (adds - dels) * round;

        Assert.assertEquals(stateSizeExpected, checkThatStateExistsInStore(state, store1, round));
        Assert.assertEquals(deletesExpected, checkThatDeletionsApplied(changes, store1, round));

        Assert.assertEquals(stateSizeExpected, checkThatStateExistsInStore(state, store2, round));
        Assert.assertEquals(deletesExpected, checkThatDeletionsApplied(changes, store2, round));
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:28,代码来源:MultiWriteKeyColumnValueStoreTest.java

示例2: checkThatDeletionsApplied

import com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation; //导入依赖的package包/类
public int checkThatDeletionsApplied(Map<StaticBuffer, KCVEntryMutation> changes, KeyColumnValueStore store, int round) throws BackendException {
    int checked = 0;
    int skipped = 0;

    for (StaticBuffer key : changes.keySet()) {
        KCVEntryMutation m = changes.get(key);

        if (!m.hasDeletions())
            continue;

        List<Entry> deletions = m.getDeletions();

        List<Entry> additions = m.getAdditions();

        for (Entry entry : deletions) {
            StaticBuffer col = entry.getColumn();

            if (null != additions && additions.contains(StaticArrayEntry.of(col, col))) {
                skipped++;
                continue;
            }

            Assert.assertNull(KCVSUtil.get(store, key, col, tx));

            checked++;
        }
    }

    log.debug("Checked absence of {} key-column-value deletions on round {} (skipped {})", new Object[]{checked, round, skipped});

    return checked;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:33,代码来源:MultiWriteKeyColumnValueStoreTest.java

示例3: deletionsAppliedBeforeAdditions

import com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation; //导入依赖的package包/类
@Test
public void deletionsAppliedBeforeAdditions() throws BackendException {

    StaticBuffer b1 = KeyColumnValueStoreUtil.longToByteBuffer(1);

    Assert.assertNull(KCVSUtil.get(store1, b1, b1, tx));

    List<Entry> additions = Lists.newArrayList(StaticArrayEntry.of(b1, b1));

    List<Entry> deletions = Lists.newArrayList(additions);

    Map<StaticBuffer, KCVEntryMutation> combination = new HashMap<StaticBuffer, KCVEntryMutation>(1);
    Map<StaticBuffer, KCVEntryMutation> deleteOnly = new HashMap<StaticBuffer, KCVEntryMutation>(1);
    Map<StaticBuffer, KCVEntryMutation> addOnly = new HashMap<StaticBuffer, KCVEntryMutation>(1);

    combination.put(b1, new KCVEntryMutation(additions, deletions));
    deleteOnly.put(b1, new KCVEntryMutation(KeyColumnValueStore.NO_ADDITIONS, deletions));
    addOnly.put(b1, new KCVEntryMutation(additions, KCVSCache.NO_DELETIONS));

    store1.mutateEntries(b1, additions, deletions, tx);
    newTx();

    StaticBuffer result = KCVSUtil.get(store1, b1, b1, tx);

    Assert.assertEquals(b1, result);

    store1.mutateEntries(b1, NO_ADDITIONS, deletions, tx);
    newTx();

    for (int i = 0; i < 100; i++) {
        StaticBuffer n = KCVSUtil.get(store1, b1, b1, tx);
        Assert.assertNull(n);
        store1.mutateEntries(b1, additions, KCVSCache.NO_DELETIONS, tx);
        newTx();
        store1.mutateEntries(b1, NO_ADDITIONS, deletions, tx);
        newTx();
        n = KCVSUtil.get(store1, b1, b1, tx);
        Assert.assertNull(n);
    }

    for (int i = 0; i < 100; i++) {
        store1.mutateEntries(b1, NO_ADDITIONS, deletions, tx);
        newTx();
        store1.mutateEntries(b1, additions, KCVSCache.NO_DELETIONS, tx);
        newTx();
        Assert.assertEquals(b1, KCVSUtil.get(store1, b1, b1, tx));
    }

    for (int i = 0; i < 100; i++) {
        store1.mutateEntries(b1, additions, deletions, tx);
        newTx();
        Assert.assertEquals(b1, KCVSUtil.get(store1, b1, b1, tx));
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:55,代码来源:MultiWriteKeyColumnValueStoreTest.java

示例4: applyChanges

import com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation; //导入依赖的package包/类
public void applyChanges(Map<StaticBuffer, KCVEntryMutation> changes, KCVSCache store, StoreTransaction tx) throws BackendException {
    for (Map.Entry<StaticBuffer, KCVEntryMutation> change : changes.entrySet()) {
        store.mutateEntries(change.getKey(), change.getValue().getAdditions(), change.getValue().getDeletions(), tx);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:6,代码来源:MultiWriteKeyColumnValueStoreTest.java

示例5: consolidate

import com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation; //导入依赖的package包/类
@Override
public void consolidate() {
    super.consolidate(KCVEntryMutation.ENTRY2COLUMN_FCT, Functions.<StaticBuffer>identity());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:5,代码来源:KCVMutation.java

示例6: isConsolidated

import com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.KCVEntryMutation; //导入依赖的package包/类
@Override
public boolean isConsolidated() {
    return super.isConsolidated(KCVEntryMutation.ENTRY2COLUMN_FCT, Functions.<StaticBuffer>identity());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:5,代码来源:KCVMutation.java


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