hypercore-storage 1.0.8 → 1.0.10
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 +8 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -90,7 +90,7 @@ class HypercoreStorage {
|
|
|
90
90
|
const deps = this.core.dependencies
|
|
91
91
|
|
|
92
92
|
for (let i = deps.length - 1; i >= 0; i--) {
|
|
93
|
-
if (deps[i].length
|
|
93
|
+
if (deps[i].length > length) continue
|
|
94
94
|
|
|
95
95
|
this.core = {
|
|
96
96
|
corePointer: this.core.corePointer,
|
|
@@ -98,9 +98,11 @@ class HypercoreStorage {
|
|
|
98
98
|
dependencies: deps.slice(0, i + 1)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
this.core.dependencies[i]
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (this.core.dependencies[i].length !== length) {
|
|
102
|
+
this.core.dependencies[i] = {
|
|
103
|
+
dataPointer: deps[i].dataPointer,
|
|
104
|
+
length
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
return
|
|
@@ -344,11 +346,8 @@ class CorestoreStorage {
|
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
// runs pre the core is returned to the user
|
|
347
|
-
async _migrateCore (core, discoveryKey, locked) {
|
|
349
|
+
async _migrateCore (core, discoveryKey, version, locked) {
|
|
348
350
|
const view = locked ? this.view : await this._enter()
|
|
349
|
-
|
|
350
|
-
const version = core.core.version
|
|
351
|
-
|
|
352
351
|
try {
|
|
353
352
|
if (version === VERSION) return
|
|
354
353
|
|
|
@@ -364,8 +363,6 @@ class CorestoreStorage {
|
|
|
364
363
|
}
|
|
365
364
|
}
|
|
366
365
|
|
|
367
|
-
core.core.version = VERSION
|
|
368
|
-
|
|
369
366
|
if (locked === false) return
|
|
370
367
|
|
|
371
368
|
// if its locked, then move the core state into the memview
|
|
@@ -603,7 +600,7 @@ class CorestoreStorage {
|
|
|
603
600
|
|
|
604
601
|
const result = new HypercoreStorage(this, this.db.session(), core, EMPTY, null)
|
|
605
602
|
|
|
606
|
-
if (version < VERSION) await this._migrateCore(result, discoveryKey, create)
|
|
603
|
+
if (version < VERSION) await this._migrateCore(result, discoveryKey, version, create)
|
|
607
604
|
return result
|
|
608
605
|
}
|
|
609
606
|
|