Search in sources :

Example 6 with ByteIterable

use of jetbrains.exodus.ByteIterable in project xodus by JetBrains.

the class TreeCursorMutable method treeChanged.

@Override
public void treeChanged() {
    final ByteIterable key = getKey();
    final ByteIterable value = getValue();
    // moveToPair(key, value);
    moveToKey = key;
    moveToValue = value;
}
Also used : ByteIterable(jetbrains.exodus.ByteIterable)

Example 7 with ByteIterable

use of jetbrains.exodus.ByteIterable in project xodus by JetBrains.

the class EnvironmentTestInMemory method deleteRandomKey.

private void deleteRandomKey(Store primary, Store secondary, Transaction txn, int keysCount, Persistent23TreeMap.MutableMap<Integer, Integer> testMap) {
    final int key = rnd.nextInt(keysCount);
    testMap.remove(key);
    final ArrayByteIterable keyEntry = IntegerBinding.intToCompressedEntry(key);
    final ByteIterable oldValue = primary.get(txn, keyEntry);
    primary.delete(txn, keyEntry);
    if (oldValue != null) {
        try (Cursor cursor = secondary.openCursor(txn)) {
            Assert.assertTrue(cursor.getSearchBoth(oldValue, keyEntry));
            Assert.assertTrue(cursor.deleteCurrent());
        }
    }
}
Also used : ArrayByteIterable(jetbrains.exodus.ArrayByteIterable) ByteIterable(jetbrains.exodus.ByteIterable) ArrayByteIterable(jetbrains.exodus.ArrayByteIterable)

Example 8 with ByteIterable

use of jetbrains.exodus.ByteIterable in project xodus by JetBrains.

the class EnvironmentTestsBase method assertNotNullStringValue.

protected void assertNotNullStringValue(final Transaction txn, final Store store, final ByteIterable keyEntry, final String value) {
    final ByteIterable valueEntry = store.get(txn, keyEntry);
    Assert.assertNotNull(valueEntry);
    Assert.assertEquals(value, StringBinding.entryToString(valueEntry));
}
Also used : ByteIterable(jetbrains.exodus.ByteIterable)

Example 9 with ByteIterable

use of jetbrains.exodus.ByteIterable in project xodus by JetBrains.

the class EnvironmentTestsBase method assertEmptyValue.

protected void assertEmptyValue(final Transaction txn, final Store store, final ByteIterable keyEntry) {
    final ByteIterable valueEntry = store.get(txn, keyEntry);
    Assert.assertNull(valueEntry);
}
Also used : ByteIterable(jetbrains.exodus.ByteIterable)

Example 10 with ByteIterable

use of jetbrains.exodus.ByteIterable in project xodus by JetBrains.

the class TreeCursorNoDuplicatesTest method testGetSearchKeyRange5.

@Test
public void testGetSearchKeyRange5() throws IOException {
    tm = createMutableTree(false, 1);
    final ByteIterable v = value("0");
    tm.put(key("aaba"), v);
    tm.put(key("aabb"), v);
    Cursor c = tm.openCursor();
    assertNotNull(c.getSearchKeyRange(key("aababa")));
    assertEquals(key("aabb"), c.getKey());
}
Also used : ByteIterable(jetbrains.exodus.ByteIterable) ArrayByteIterable(jetbrains.exodus.ArrayByteIterable) Cursor(jetbrains.exodus.env.Cursor) Test(org.junit.Test)

Aggregations

ByteIterable (jetbrains.exodus.ByteIterable)86 ArrayByteIterable (jetbrains.exodus.ArrayByteIterable)45 Test (org.junit.Test)26 CompressedUnsignedLongByteIterable (jetbrains.exodus.log.CompressedUnsignedLongByteIterable)15 Nullable (org.jetbrains.annotations.Nullable)11 ITreeCursor (jetbrains.exodus.tree.ITreeCursor)8 Cursor (jetbrains.exodus.env.Cursor)7 RandomAccessLoggable (jetbrains.exodus.log.RandomAccessLoggable)7 CompoundByteIterable (jetbrains.exodus.CompoundByteIterable)6 Store (jetbrains.exodus.env.Store)4 TreeSet (java.util.TreeSet)3 Transaction (jetbrains.exodus.env.Transaction)3 Exchange (com.persistit.Exchange)2 ExodusException (jetbrains.exodus.ExodusException)2 TokyoCabinetBenchmark (jetbrains.exodus.benchmark.TokyoCabinetBenchmark)2 Pair (jetbrains.exodus.core.dataStructures.Pair)2 HashSet (jetbrains.exodus.core.dataStructures.hash.HashSet)2 PersistentLongSet (jetbrains.exodus.core.dataStructures.persistent.PersistentLongSet)2 PersistentStoreTransaction (jetbrains.exodus.entitystore.PersistentStoreTransaction)2 Loggable (jetbrains.exodus.log.Loggable)2