當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。