Re-add RocksDb interface (#356)
* Re-add RocksDb (still in testing) * Add bytes_per_sync option * Move tests (unused) * Move tests
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
"lru_map": "^0.3.3",
|
||||
"mkdirp": "^0.5.1",
|
||||
"node-lmdb": "^0.6.2",
|
||||
"rocksdb-node": "jacogr/rocksdb-node#00ebfdbf0462ee615f4f48f1db403fd4df8471ea",
|
||||
"snappy": "^6.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -18,6 +18,13 @@ import { bufferToU8a, logger, u8aToBuffer, u8aToHex } from '@polkadot/util/index
|
||||
|
||||
const l = logger('db/rocksdb');
|
||||
|
||||
const OPEN_OPTIONS = {
|
||||
allow_mmap_reads: true,
|
||||
allow_mmap_writes: true,
|
||||
bytes_per_sync: 1 * 1024 * 1024, // 1MB default
|
||||
create_if_missing: true
|
||||
};
|
||||
|
||||
export default class Rocks implements BaseDb {
|
||||
private db: RocksDb;
|
||||
|
||||
@@ -26,7 +33,7 @@ export default class Rocks implements BaseDb {
|
||||
|
||||
mkdirp.sync(location);
|
||||
|
||||
this.db = rocksdb.open({ create_if_missing: true }, location);
|
||||
this.db = rocksdb.open(OPEN_OPTIONS, location);
|
||||
}
|
||||
|
||||
close (): void {
|
||||
@@ -7,7 +7,7 @@ import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import { stringToU8a } from '@polkadot/util/index';
|
||||
|
||||
import RocksDb from './RocksDb';
|
||||
import RocksDb from '../RocksDb';
|
||||
|
||||
describe.skip('RocksDb', () => {
|
||||
const base = path.join(os.tmpdir(), '--test--');
|
||||
|
||||
Reference in New Issue
Block a user