Swap default backing DB to FileFlat (interim)
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
|
||||
import LevelDb from './engines/LevelDb';
|
||||
import FileFlatDb from './engines/FileFlatDb';
|
||||
import LruDb from './engines/LruDb';
|
||||
import TransactionDb from './engines/TransactionDb';
|
||||
|
||||
export default class DiskDb extends TransactionDb {
|
||||
constructor (location: string) {
|
||||
constructor (location: string, file?: string) {
|
||||
super(
|
||||
new LruDb(
|
||||
new LevelDb(location)
|
||||
new FileFlatDb(location, file)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { BaseDb, ProgressCb } from '../types';
|
||||
|
||||
import fs from 'fs';
|
||||
// import snappy from 'snappy';
|
||||
import snappy from 'snappy';
|
||||
import assert from '@polkadot/util/assert';
|
||||
import logger from '@polkadot/util/logger';
|
||||
import bufferToU8a from '@polkadot/util/buffer/toU8a';
|
||||
@@ -141,19 +141,19 @@ export default class FileFlatDb implements BaseDb {
|
||||
}
|
||||
|
||||
private _deserializeValue (value: Buffer): Uint8Array | null {
|
||||
// return bufferToU8a(
|
||||
// snappy.uncompressSync(value)
|
||||
// );
|
||||
// return bufferToU8a(value);
|
||||
|
||||
return bufferToU8a(value);
|
||||
return bufferToU8a(
|
||||
snappy.uncompressSync(value)
|
||||
);
|
||||
}
|
||||
|
||||
private _serializeValue (value: Uint8Array): Buffer {
|
||||
// return snappy.compressSync(
|
||||
// u8aToBuffer(value)
|
||||
// );
|
||||
// return u8aToBuffer(value);
|
||||
|
||||
return u8aToBuffer(value);
|
||||
return snappy.compressSync(
|
||||
u8aToBuffer(value)
|
||||
);
|
||||
}
|
||||
|
||||
private _serializeKey (key: Uint8Array): Buffer {
|
||||
|
||||
Reference in New Issue
Block a user