use of jetbrains.exodus.ArrayByteIterable in project xodus by JetBrains.
the class GarbageCollectorInterleavingTest method fill.
private void fill(@NotNull final String table) {
final ByteIterable val0 = StringBinding.stringToEntry("val0");
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull Transaction txn) {
final StoreImpl store = env.openStore(table, getStoreConfig(), txn);
for (int i = 0; i < getRecordsNumber(); ++i) {
final ArrayByteIterable key = StringBinding.stringToEntry("key " + i);
store.put(txn, key, val0);
}
}
});
}
use of jetbrains.exodus.ArrayByteIterable in project xodus by JetBrains.
the class GarbageCollectorInterleavingTest method check.
private void check(@NotNull final String table) {
final ByteIterable val0 = StringBinding.stringToEntry("val0");
env.executeInReadonlyTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull Transaction txn) {
final Store store = env.openStore(table, getStoreConfig(), txn);
for (int i = 0; i < getRecordsNumber(); ++i) {
final ArrayByteIterable key = StringBinding.stringToEntry("key " + i);
Assert.assertTrue(store.exists(txn, key, val0));
}
}
});
}
use of jetbrains.exodus.ArrayByteIterable in project xodus by JetBrains.
the class GarbageCollectorTest method xd98.
@Test
public void xd98() {
setLogFileSize(64);
env.getEnvironmentConfig().setGcEnabled(false);
final Store store = openStoreAutoCommit("store");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 100; ++i) {
builder.append("01234567890123456789012345678901234567890123456789");
final ArrayByteIterable value = StringBinding.stringToEntry(builder.toString());
putAutoCommit(store, IntegerBinding.intToEntry(0), value);
}
env.getGC().cleanWholeLog();
Assert.assertEquals(1L, env.getLog().getNumberOfFiles());
}
use of jetbrains.exodus.ArrayByteIterable in project xodus by JetBrains.
the class ImmutableNode method extractLazyIterable.
private static ByteIterable extractLazyIterable(@NotNull final ByteIterableWithAddress data, @NotNull final ByteIteratorWithAddress it) {
final int length = CompressedUnsignedLongByteIterable.getInt(it);
if (length == 1) {
return ArrayByteIterable.fromByte(it.next());
}
if (length < LAZY_KEY_VALUE_ITERABLE_MIN_LENGTH) {
return new ArrayByteIterable(it, length);
}
final ByteIterable result = data.subIterable((int) (it.getAddress() - data.getDataAddress()), length);
it.skip(length);
return result;
}
use of jetbrains.exodus.ArrayByteIterable in project xodus by JetBrains.
the class VfsSettings method get.
ByteIterable get(@Nullable final Transaction txn, @NotNull final String settingName) {
final ArrayByteIterable key = StringBinding.stringToEntry(settingName);
if (txn != null) {
return settingStore.get(txn, key);
}
final ByteIterable[] result = new ByteIterable[1];
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull final Transaction txn) {
result[0] = settingStore.get(txn, key);
}
});
return result[0];
}
Aggregations