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 {
|
||||
// public
|
||||
installEncryptionFormat,
|
||||
|
@ -1101,7 +1094,10 @@ function initDB(peer, config) {
|
|||
getTangle,
|
||||
msgs,
|
||||
records,
|
||||
logStats,
|
||||
log: {
|
||||
stats: log.stats.bind(log),
|
||||
compact: log.compact.bind(log),
|
||||
},
|
||||
|
||||
// internal
|
||||
findEncryptionFormatFor,
|
||||
|
|
|
@ -48,8 +48,7 @@ test('add()', async (t) => {
|
|||
const rec = await p(peer.db.add)(inputMsg, rootID)
|
||||
assert.equal(rec.msg.data.text, 'This is the first post!')
|
||||
|
||||
await p(peer.db._getLog().onDrain)()
|
||||
const stats = await p(peer.db.logStats)()
|
||||
const stats = await p(peer.db.log.stats)()
|
||||
assert.deepEqual(stats, { totalBytes: 1450, deletedBytes: 0 })
|
||||
|
||||
await p(peer.close)(true)
|
||||
|
|
Loading…
Reference in New Issue