fix backend selection.
This commit is contained in:
parent
f72d914077
commit
131e546fb3
@ -17,7 +17,7 @@ module.exports = function ldb(name, options) {
|
||||
|
||||
if (!db[file]) {
|
||||
if (bcoin.isBrowser) {
|
||||
backend = 'level-js';
|
||||
backend = require('level-js');
|
||||
} else {
|
||||
if (!backend || backend === 'rocksdb')
|
||||
backend = 'rocksdown';
|
||||
@ -25,10 +25,8 @@ module.exports = function ldb(name, options) {
|
||||
backend = 'leveldown';
|
||||
else if (backend === 'lmdb')
|
||||
backend = 'lmdb';
|
||||
else if (backend === 'tree')
|
||||
backend = 'tree';
|
||||
else
|
||||
assert(false, 'Bad DB.');
|
||||
|
||||
backend = require(backend);
|
||||
}
|
||||
|
||||
db[file] = new levelup(file, {
|
||||
@ -46,7 +44,7 @@ module.exports = function ldb(name, options) {
|
||||
mapSize: options.mapSize || 150 * (1024 << 20),
|
||||
writeMap: options.writeMap || false,
|
||||
|
||||
db: require(backend)
|
||||
db: backend
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user