use of jetbrains.exodus.tree.ITree in project xodus by JetBrains.
the class BTreeStructureIdTest method assertContains.
private void assertContains(long expectedId, long address) {
ITree firstImTree = new BTree(log, address, false, 3);
LongIterator it = firstImTree.addressIterator();
while (it.hasNext()) Assert.assertEquals(expectedId, log.read(it.next()).getStructureId());
}
use of jetbrains.exodus.tree.ITree in project xodus by JetBrains.
the class StoreImpl method get.
@Override
@Nullable
public ByteIterable get(@NotNull final Transaction txn, @NotNull final ByteIterable key) {
final TransactionBase tx = (TransactionBase) txn;
final ITree tree = tx.getTree(this);
final long treeRootAddress = tree.getRootAddress();
final StoreGetCache storeGetCache = environment.getStoreGetCache();
final boolean useStoreGetCache = treeRootAddress != Loggable.NULL_ADDRESS && storeGetCache != null;
// if neither tree is empty nor mutable and StoreGetCache is on
if (useStoreGetCache) {
ByteIterable result = storeGetCache.tryKey(treeRootAddress, key);
if (result != null) {
return result == NULL_CACHED_VALUE ? null : result;
}
result = tree.get(key);
storeGetCache.cacheObject(treeRootAddress, key, result == null ? NULL_CACHED_VALUE : new ArrayByteIterable(result));
return result;
}
return tree.get(key);
}
Aggregations