hyperbee2 2.1.0 → 2.2.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 +10 -1
- package/lib/write.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -30,7 +30,8 @@ class Hyperbee {
|
|
|
30
30
|
activeRequests = [],
|
|
31
31
|
view = false,
|
|
32
32
|
writable = true,
|
|
33
|
-
unbatch = 0
|
|
33
|
+
unbatch = 0,
|
|
34
|
+
autoUpdate = false
|
|
34
35
|
} = options
|
|
35
36
|
|
|
36
37
|
this.store = store
|
|
@@ -42,6 +43,8 @@ class Hyperbee {
|
|
|
42
43
|
this.writable = writable
|
|
43
44
|
this.unbatch = unbatch
|
|
44
45
|
|
|
46
|
+
this._autoUpdate = autoUpdate
|
|
47
|
+
|
|
45
48
|
this.ready().catch(noop)
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -117,6 +120,12 @@ class Hyperbee {
|
|
|
117
120
|
this.context.core.length === 0
|
|
118
121
|
? EMPTY
|
|
119
122
|
: new TreeNodePointer(this.context, 0, this.core.length - 1, 0, false, null)
|
|
123
|
+
|
|
124
|
+
if (this._autoUpdate) {
|
|
125
|
+
this.core.on('append', () => {
|
|
126
|
+
this.update()
|
|
127
|
+
})
|
|
128
|
+
}
|
|
120
129
|
}
|
|
121
130
|
|
|
122
131
|
async close() {
|
package/lib/write.js
CHANGED
|
@@ -324,7 +324,7 @@ module.exports = class WriteBatch {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
_shouldInlineValue(k) {
|
|
327
|
-
if (!k.value || supportsCompression(this.type)) return true
|
|
327
|
+
if (!k.value || !supportsCompression(this.type)) return true
|
|
328
328
|
if (k.valuePointer) return true
|
|
329
329
|
return k.value.byteLength <= this.inlineValueSize
|
|
330
330
|
}
|