hypercore-storage 1.1.2 → 1.1.4
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 +6 -2
- package/lib/view.js +3 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -240,14 +240,18 @@ class HypercoreStorage {
|
|
|
240
240
|
const d = this.core.dependencies[i]
|
|
241
241
|
|
|
242
242
|
if (dep !== null && d.length > dep.length) {
|
|
243
|
-
|
|
243
|
+
if (d.dataPointer !== dep.dataPointer) {
|
|
244
|
+
deps.push({ dataPointer: d.dataPointer, length: dep.length })
|
|
245
|
+
}
|
|
244
246
|
return deps
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
deps.push(d)
|
|
248
250
|
}
|
|
249
251
|
|
|
250
|
-
if (dep !== null
|
|
252
|
+
if (dep !== null && (deps.length === 0 || deps[deps.length - 1].dataPointer !== dep.dataPointer)) {
|
|
253
|
+
deps.push(dep)
|
|
254
|
+
}
|
|
251
255
|
return deps
|
|
252
256
|
}
|
|
253
257
|
|
package/lib/view.js
CHANGED
|
@@ -236,11 +236,12 @@ class View {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
async _readAndMaybeDrop (read, key) {
|
|
239
|
+
const cleared = this.cleared // in case its cleared
|
|
239
240
|
const value = await read.get(key)
|
|
240
241
|
if (value === null) return null
|
|
241
242
|
|
|
242
|
-
for (let i = 0; i <
|
|
243
|
-
const c =
|
|
243
|
+
for (let i = 0; i < cleared.length; i++) {
|
|
244
|
+
const c = cleared[i]
|
|
244
245
|
// check if in range
|
|
245
246
|
if (b4a.compare(c[0], key) <= 0 && b4a.compare(key, c[2]) < 0) return null
|
|
246
247
|
}
|