hypercore-storage 1.11.0 → 1.12.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 +19 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -384,6 +384,25 @@ class CorestoreStorage {
|
|
|
384
384
|
return this.db.ready()
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
+
async audit () {
|
|
388
|
+
for await (const { core } of this.createCoreStream()) {
|
|
389
|
+
const coreRx = new CoreRX(core, this.db, EMPTY)
|
|
390
|
+
const authPromise = coreRx.getAuth()
|
|
391
|
+
|
|
392
|
+
coreRx.tryFlush()
|
|
393
|
+
|
|
394
|
+
const auth = await authPromise
|
|
395
|
+
|
|
396
|
+
if (!auth.manifest || auth.manifest.version > 0) continue
|
|
397
|
+
if (auth.manifest.linked === null) continue
|
|
398
|
+
|
|
399
|
+
auth.manifest.linked = null
|
|
400
|
+
const coreTx = new CoreTX(core, this.db, null, [])
|
|
401
|
+
coreTx.setAuth(auth)
|
|
402
|
+
await coreTx.flush()
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
387
406
|
async deleteCore (ptr) {
|
|
388
407
|
const rx = new CoreRX(ptr, this.db, EMPTY)
|
|
389
408
|
|