Search in sources :

Example 91 with ByteIterable

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

the class BTreeMutable method put.

@Override
public void put(@NotNull INode ln) {
    final ByteIterable value = ln.getValue();
    if (value == null) {
        throw new ExodusException("Value can't be null");
    }
    put(ln.getKey(), value);
}
Also used : CompoundByteIterable(jetbrains.exodus.CompoundByteIterable) ByteIterable(jetbrains.exodus.ByteIterable) ExodusException(jetbrains.exodus.ExodusException)

Example 92 with ByteIterable

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

the class BTreeMutable method putRight.

@Override
public void putRight(@NotNull INode ln) {
    final ByteIterable value = ln.getValue();
    if (value == null) {
        throw new ExodusException("Value can't be null");
    }
    putRight(ln.getKey(), value);
}
Also used : CompoundByteIterable(jetbrains.exodus.CompoundByteIterable) ByteIterable(jetbrains.exodus.ByteIterable) ExodusException(jetbrains.exodus.ExodusException)

Example 93 with ByteIterable

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

the class BasePage method isInPageRange.

boolean isInPageRange(@NotNull final ByteIterable key, @Nullable final ByteIterable value) {
    final ILeafNode maxKey = getMaxKey();
    int cmp = maxKey.getKey().compareTo(key);
    if (cmp < 0) {
        return false;
    }
    if (cmp == 0 && value != null) {
        @Nullable final ByteIterable maxValue = maxKey.getValue();
        if (maxValue == null || maxValue.compareTo(value) < 0) {
            return false;
        }
    }
    if (size == 1) {
        return true;
    }
    final ILeafNode minKey = getMinKey();
    cmp = minKey.getKey().compareTo(key);
    if (cmp > 0) {
        return false;
    }
    if (cmp == 0 && value != null) {
        @Nullable final ByteIterable minValue = minKey.getValue();
        return minValue != null && minValue.compareTo(value) <= 0;
    }
    return true;
}
Also used : ByteIterable(jetbrains.exodus.ByteIterable) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

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