use of com.persistit.Exchange in project xodus by JetBrains.
the class JMHPersistItTokyoCabinetReadBenchmark method randomRead.
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = WARMUP_ITERATIONS)
@Measurement(iterations = MEASUREMENT_ITERATIONS)
@Fork(FORKS)
public void randomRead(final Blackhole bh) throws PersistitException {
final Exchange exchange = createTestStore();
for (final ByteIterable key : randomKeys) {
exchange.clear();
for (int i = 0; i < key.getLength(); i++) {
exchange.append(key.getBytesUnsafe()[i]);
}
exchange.fetch();
bh.consume(((byte[]) exchange.getValue().get()).length);
}
}
use of com.persistit.Exchange in project xodus by JetBrains.
the class JMHPersistItTokyoCabinetReadBenchmark method successiveRead.
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = WARMUP_ITERATIONS)
@Measurement(iterations = MEASUREMENT_ITERATIONS)
@Fork(FORKS)
public void successiveRead(final Blackhole bh) throws PersistitException {
final Exchange exchange = createTestStore();
exchange.clear();
exchange.append(Key.BEFORE);
while (exchange.traverse(Key.GT, true)) {
bh.consume(exchange.getKey().toString().length());
bh.consume(((byte[]) exchange.getValue().get()).length);
}
}
use of com.persistit.Exchange in project titan by thinkaurelius.
the class PersistitStoreManager method clearStorage.
@Override
public void clearStorage() throws StorageException {
for (String key : stores.keySet()) {
PersistitKeyValueStore store = stores.remove(key);
store.clear();
}
Volume volume;
String[] treeNames;
try {
volume = db.getVolume(VOLUME_NAME);
treeNames = volume.getTreeNames();
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
for (String treeName : treeNames) {
try {
Exchange ex = new Exchange(db, volume, treeName, false);
ex.removeTree();
} catch (PersistitException ex) {
throw new PermanentStorageException(ex);
}
}
close();
IOUtils.deleteFromDirectory(directory);
}
Aggregations