hypercore-storage 1.14.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +11 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -183,6 +183,13 @@ class HypercoreStorage {
|
|
|
183
183
|
return new HypercoreStorage(this.store, this.db.snapshot(), this.core, this.view.snapshot(), this.atom)
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
compact () {
|
|
187
|
+
return Promise.all([
|
|
188
|
+
this.db.compactRange(core.core(this.core.corePointer), core.core(this.core.corePointer)),
|
|
189
|
+
this.db.compactRange(core.data(this.core.dataPointer), core.data(this.core.dataPointer))
|
|
190
|
+
])
|
|
191
|
+
}
|
|
192
|
+
|
|
186
193
|
atomize (atom) {
|
|
187
194
|
if (this.atom && this.atom !== atom) throw new Error('Cannot atomize and atomized session with a new atom')
|
|
188
195
|
return new HypercoreStorage(this.store, this.db.session(), this.core, atom.view, atom)
|
|
@@ -426,6 +433,10 @@ class CorestoreStorage {
|
|
|
426
433
|
return this.db.ready()
|
|
427
434
|
}
|
|
428
435
|
|
|
436
|
+
compact () {
|
|
437
|
+
return this.db.compactRange()
|
|
438
|
+
}
|
|
439
|
+
|
|
429
440
|
async audit () {
|
|
430
441
|
for await (const { core } of this.createCoreStream()) {
|
|
431
442
|
const coreRx = new CoreRX(core, this.db, EMPTY)
|