use of com.alipay.sofa.jraft.rhea.options.RocksDBOptions in project sofa-jraft by sofastack.
the class BaseKVStoreTest method setup.
protected void setup() throws Exception {
File file = getTempDir();
this.tempPath = file.getAbsolutePath();
this.kvStore = new RocksRawKVStore();
this.dbOptions = new RocksDBOptions();
this.dbOptions.setStatisticsCallbackIntervalSeconds(10);
this.dbOptions.setDbPath(this.tempPath);
this.kvStore.init(this.dbOptions);
}
use of com.alipay.sofa.jraft.rhea.options.RocksDBOptions in project sofa-jraft by sofastack.
the class BaseRawStoreBenchmark method setup.
protected void setup() throws Exception {
File file = getTempDir();
this.tempPath = file.getAbsolutePath();
System.out.println(this.tempPath);
this.kvStore = new RocksRawKVStore();
this.dbOptions = new RocksDBOptions();
this.dbOptions.setDbPath(this.tempPath);
this.dbOptions.setSync(false);
this.kvStore.init(this.dbOptions);
}
use of com.alipay.sofa.jraft.rhea.options.RocksDBOptions in project sofa-jraft by sofastack.
the class StoreEngine method initRocksDB.
private boolean initRocksDB(final StoreEngineOptions opts) {
RocksDBOptions rocksOpts = opts.getRocksDBOptions();
if (rocksOpts == null) {
rocksOpts = new RocksDBOptions();
opts.setRocksDBOptions(rocksOpts);
}
String dbPath = rocksOpts.getDbPath();
if (Strings.isNotBlank(dbPath)) {
try {
FileUtils.forceMkdir(new File(dbPath));
} catch (final Throwable t) {
LOG.error("Fail to make dir for dbPath {}.", dbPath);
return false;
}
} else {
dbPath = "";
}
final String childPath = "db_" + this.storeId + "_" + opts.getServerAddress().getPort();
rocksOpts.setDbPath(Paths.get(dbPath, childPath).toString());
this.dbPath = new File(rocksOpts.getDbPath());
final RocksRawKVStore rocksRawKVStore = new RocksRawKVStore();
if (!rocksRawKVStore.init(rocksOpts)) {
LOG.error("Fail to init [RocksRawKVStore].");
return false;
}
this.rawKVStore = rocksRawKVStore;
return true;
}
Aggregations