Skip to content
Snippets Groups Projects
Commit 7a401afb authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] Gather LevelDB data into a new `data/` dir

parent b4f82f2c
No related branches found
No related tags found
No related merge requests found
......@@ -118,7 +118,7 @@ export const MemFS = (initialTree:{ [folder:string]: { [file:string]: string }}
export const Directory = {
DATA_FILES: ['mindex.db', 'c_mindex.db', 'iindex.db', 'cindex.db', 'sindex.db', 'wallet.db', 'dividend.db', 'txs.db', 'peers.db'],
DATA_DIRS: ['level_dividend', 'level_bindex', 'level_blockchain', 'level_sindex', 'level_cindex', 'level_iindex', 'level_mindex', 'level_wallet'],
DATA_DIRS: ['data'],
INSTANCE_NAME: getDomain(opts.mdb),
INSTANCE_HOME: getHomePath(opts.mdb, opts.home),
......@@ -145,7 +145,9 @@ export const Directory = {
return LevelDBDriver.newMemoryInstance()
}
// Or file
const levelDBPath = path.join(home || Directory.INSTANCE_HOME, dbName)
const levelDbRootPath = path.join(home, 'data', 'leveldb')
await RealFS().fsMakeDirectory(levelDbRootPath)
const levelDBPath = path.join(levelDbRootPath, dbName)
return LevelDBDriver.newFileInstance(levelDBPath)
},
......
......@@ -453,7 +453,8 @@ export class Server extends stream.Duplex implements HookableServer {
await this.dal.cleanCaches();
this.dal.wotb.resetWoT();
const files = ['stats', 'cores', 'current', Directory.DUNITER_DB_NAME, Directory.DUNITER_DB_NAME + '.db', Directory.DUNITER_DB_NAME + '.log'];
const dirs = ['loki', 'blocks', 'ud_history', 'branches', 'certs', 'txs', 'cores', 'sources', 'links', 'ms', 'identities', 'peers', 'indicators', 'leveldb'];
const dirs = ['loki', 'blocks', 'ud_history', 'branches', 'certs', 'txs', 'cores', 'sources', 'links', 'ms', 'identities', 'peers', 'indicators', 'leveldb']
.concat(Directory.DATA_DIRS)
return this.resetFiles(files, dirs);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment