File lastModDir = new File(dbRoot, LAST_MOD_DIR);
_verifyDir(lastModDir, canCreate);
StorableConverter storableConv = _storeConfig.createStorableConverter();
Iq80DBFactory factory = Iq80DBFactory.factory;
Options options = new Options();
options = options
.createIfMissing(canCreate)
.logger(_ldbLogger)
.verifyChecksums(false)
;
DB dataDB;
try {
options = options.cacheSize(_levelDBConfig.dataCacheSize.getNumberOfBytes());
dataDB = factory.open(dataDir, options);
} catch (IOException e) {
throw new IllegalStateException("Failed to open main data LevelDB: "+e.getMessage(), e);
}
DB indexDB;
try {
options = options.cacheSize(_levelDBConfig.dataCacheSize.getNumberOfBytes());
indexDB = factory.open(lastModDir, options);
} catch (IOException e) {
throw new IllegalStateException("Failed to open last-mod index LevelDB: "+e.getMessage(), e);
}
return new LevelDBStoreBackend(storableConv, dbRoot, dataDB, indexDB);
}