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:
Jaco Greeff
2019-03-11 12:51:09 +01:00
committed by GitHub
parent 0d5325071d
commit 4ae7e4febb
5 changed files with 48 additions and 28 deletions
+1
View File
@@ -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"
}
}
@@ -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--');