hyperbee2 2.4.2 → 2.4.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 +4 -2
- package/lib/cache.js +1 -1
- package/lib/context.js +4 -5
- package/lib/write.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -367,9 +367,10 @@ async function inflateKeyCohort(context, d, ptr, block, config) {
|
|
|
367
367
|
return new DeltaCohort(false, p, await Promise.all(promises))
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
function inflateChild(context, d, ptr, block, config) {
|
|
370
|
+
async function inflateChild(context, d, ptr, block, config) {
|
|
371
371
|
if (d.type === OP_COHORT) return inflateChildCohort(context, d, ptr, block, config)
|
|
372
|
-
|
|
372
|
+
if (d.pointer && !context.hasCore(d.pointer.core)) await context.update(config)
|
|
373
|
+
return inflateChildDelta(context, d, ptr, block, config)
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
function inflateChildDelta(context, d, ptr, block, config) {
|
|
@@ -391,6 +392,7 @@ async function inflateChildCohort(context, d, ptr, block, config) {
|
|
|
391
392
|
|
|
392
393
|
for (let i = 0; i < cohort.length; i++) {
|
|
393
394
|
const c = cohort[i]
|
|
395
|
+
if (c.pointer && !context.hasCore(c.pointer.core)) await context.update(config)
|
|
394
396
|
deltas[i] = inflateChildDelta(context, c, co, blk, config)
|
|
395
397
|
}
|
|
396
398
|
|
package/lib/cache.js
CHANGED
|
@@ -88,6 +88,6 @@ module.exports = class NodeCache {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function cacheId(node) {
|
|
91
|
-
const id = node.
|
|
91
|
+
const id = node.context.getCore(node.core).id
|
|
92
92
|
return id + '@' + node.seq + '.' + node.offset
|
|
93
93
|
}
|
package/lib/context.js
CHANGED
|
@@ -41,6 +41,10 @@ class CoreContext {
|
|
|
41
41
|
await this._inflateCheckpoint(length, block, config)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
hasCore(core) {
|
|
45
|
+
return core <= this.opened.length
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
async _inflateCheckpoint(length, block, config) {
|
|
45
49
|
const checkpoint = block.checkpoint
|
|
46
50
|
|
|
@@ -149,11 +153,6 @@ class CoreContext {
|
|
|
149
153
|
const buffer = await hc.get(seq, config)
|
|
150
154
|
if (buffer === null) throw BLOCK_NOT_AVAILABLE()
|
|
151
155
|
const block = decodeBlock(buffer, seq)
|
|
152
|
-
|
|
153
|
-
if (block.checkpoint > this.checkpoint) {
|
|
154
|
-
await this._inflateCheckpoint(seq + 1, block, config)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
156
|
return block
|
|
158
157
|
}
|
|
159
158
|
|
package/lib/write.js
CHANGED
|
@@ -5,7 +5,7 @@ const { encodeBlock, TYPE_COMPAT, TYPE_LATEST } = require('./encoding.js')
|
|
|
5
5
|
const { Pointer, KeyPointer, ValuePointer, TreeNode, INSERTED, NEEDS_SPLIT } = require('./tree.js')
|
|
6
6
|
|
|
7
7
|
const PREFERRED_BLOCK_SIZE = 4096
|
|
8
|
-
const INLINE_VALUE_SIZE =
|
|
8
|
+
const INLINE_VALUE_SIZE = 1024
|
|
9
9
|
const ESTIMATED_POINTER_SIZE = 12 // conversative, seq=8b, offset=2b, core=2b
|
|
10
10
|
|
|
11
11
|
module.exports = class WriteBatch {
|