diff --git a/packages/db-diskdown/src/index.ts b/packages/db-diskdown/src/index.ts index d1fcdbb5d..1514cb087 100644 --- a/packages/db-diskdown/src/index.ts +++ b/packages/db-diskdown/src/index.ts @@ -5,13 +5,13 @@ import { DiskStore } from './types'; import { AbstractLevelDOWN } from 'abstract-leveldown'; -import { LRUMap } from 'lru_map'; +// import { LRUMap } from 'lru_map'; import isUndefined from '@polkadot/util/is/undefined'; import logger from '@polkadot/util/logger'; import Combined from './store/Combined'; -const LRU_SIZE = 16384; +// const LRU_SIZE = 16384; const KEY_LENGTH = 32; const l = logger('disk/scatter'); @@ -20,13 +20,13 @@ const noop = () => class DiskDown extends AbstractLevelDOWN { _disk: DiskStore; - _store: LRUMap; + // _store: LRUMap; constructor (location: string) { super(location); this._disk = new Combined(location); - this._store = new LRUMap(LRU_SIZE); + // this._store = new LRUMap(LRU_SIZE); } compact (progress: (message: string) => void): void { @@ -73,7 +73,7 @@ class DiskDown extends AbstractLevelDOWN { _del (key: Buffer, options: any, callback: Function) { l.debug(() => ['_del', key]); - this._store.delete(key.toString()); + // this._store.delete(key.toString()); this._disk.delete(key); process.nextTick(callback); @@ -82,7 +82,10 @@ class DiskDown extends AbstractLevelDOWN { _get (key: Buffer, options: any, callback: Function) { l.debug(() => ['_get', key.toString('hex')]); - const value = this._store.get(key.toString()) || this._disk.get(key); + // FIXME _If_ LRU is re-instated, it needs to get set once a value is + // retrieved from disk. (As of now, not needed since removed) + // const value = this._store.get(key.toString()) || this._disk.get(key); + const value = this._disk.get(key); if (isUndefined(value)) { process.nextTick(callback, new Error('NotFound')); @@ -95,7 +98,7 @@ class DiskDown extends AbstractLevelDOWN { _put (key: Buffer, value: Buffer, options: any, callback: Function) { l.debug(() => ['_put', key.toString('hex'), value]); - this._store.set(key.toString(), value); + // this._store.set(key.toString(), value); this._disk.set(key, value); process.nextTick(callback);