mirror of https://codeberg.org/pzp/pzp-db.git
expose log methods: stats, compact
This commit is contained in:
parent
ac8e730b64
commit
cfebe1f46c
12
lib/index.js
12
lib/index.js
|
@ -1064,13 +1064,6 @@ function initDB(peer, config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {CB<{ totalBytes: number; deletedBytes: number }>} cb
|
|
||||||
*/
|
|
||||||
function logStats(cb) {
|
|
||||||
log.stats(cb)
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// public
|
// public
|
||||||
installEncryptionFormat,
|
installEncryptionFormat,
|
||||||
|
@ -1101,7 +1094,10 @@ function initDB(peer, config) {
|
||||||
getTangle,
|
getTangle,
|
||||||
msgs,
|
msgs,
|
||||||
records,
|
records,
|
||||||
logStats,
|
log: {
|
||||||
|
stats: log.stats.bind(log),
|
||||||
|
compact: log.compact.bind(log),
|
||||||
|
},
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
findEncryptionFormatFor,
|
findEncryptionFormatFor,
|
||||||
|
|
|
@ -48,8 +48,7 @@ test('add()', async (t) => {
|
||||||
const rec = await p(peer.db.add)(inputMsg, rootID)
|
const rec = await p(peer.db.add)(inputMsg, rootID)
|
||||||
assert.equal(rec.msg.data.text, 'This is the first post!')
|
assert.equal(rec.msg.data.text, 'This is the first post!')
|
||||||
|
|
||||||
await p(peer.db._getLog().onDrain)()
|
const stats = await p(peer.db.log.stats)()
|
||||||
const stats = await p(peer.db.logStats)()
|
|
||||||
assert.deepEqual(stats, { totalBytes: 1450, deletedBytes: 0 })
|
assert.deepEqual(stats, { totalBytes: 1450, deletedBytes: 0 })
|
||||||
|
|
||||||
await p(peer.close)(true)
|
await p(peer.close)(true)
|
||||||
|
|
Loading…
Reference in New Issue