hypercore 10.37.9 → 10.37.11
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 +5 -0
- package/lib/batch.js +1 -1
- package/lib/core.js +3 -2
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -388,6 +388,7 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
388
388
|
crypto: this.crypto,
|
|
389
389
|
legacy: opts.legacy,
|
|
390
390
|
manifest: opts.manifest,
|
|
391
|
+
globalCache: opts.globalCache || null, // This is a temp option, not to be relied on unless you know what you are doing (no semver guarantees)
|
|
391
392
|
onupdate: this._oncoreupdate.bind(this),
|
|
392
393
|
onconflict: this._oncoreconflict.bind(this)
|
|
393
394
|
})
|
|
@@ -591,6 +592,10 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
591
592
|
return this.encryption === null ? 0 : this.encryption.padding
|
|
592
593
|
}
|
|
593
594
|
|
|
595
|
+
get globalCache () {
|
|
596
|
+
return this.core && this.core.globalCache
|
|
597
|
+
}
|
|
598
|
+
|
|
594
599
|
ready () {
|
|
595
600
|
return this.opening
|
|
596
601
|
}
|
package/lib/batch.js
CHANGED
|
@@ -301,7 +301,7 @@ module.exports = class HypercoreBatch extends EventEmitter {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
this._appends.push(
|
|
304
|
+
for (const b of buffers) this._appends.push(b)
|
|
305
305
|
|
|
306
306
|
const info = { length: this.length, byteLength: this.byteLength }
|
|
307
307
|
this.emit('append')
|
package/lib/core.js
CHANGED
|
@@ -15,7 +15,7 @@ const audit = require('./audit')
|
|
|
15
15
|
const { createTracer } = require('hypertrace')
|
|
16
16
|
|
|
17
17
|
module.exports = class Core {
|
|
18
|
-
constructor (header, compat, crypto, oplog, bigHeader, tree, blocks, bitfield, verifier, sessions, legacy, onupdate, onconflict) {
|
|
18
|
+
constructor (header, compat, crypto, oplog, bigHeader, tree, blocks, bitfield, verifier, sessions, legacy, globalCache, onupdate, onconflict) {
|
|
19
19
|
this.tracer = createTracer(this)
|
|
20
20
|
this.onupdate = onupdate
|
|
21
21
|
this.onconflict = onconflict
|
|
@@ -35,6 +35,7 @@ module.exports = class Core {
|
|
|
35
35
|
this.skipBitfield = null
|
|
36
36
|
this.active = sessions.length
|
|
37
37
|
this.sessions = sessions
|
|
38
|
+
this.globalCache = globalCache
|
|
38
39
|
|
|
39
40
|
this._manifestFlushed = !!header.manifest
|
|
40
41
|
this._maxOplogSize = 65536
|
|
@@ -194,7 +195,7 @@ module.exports = class Core {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
return new this(header, compat, crypto, oplog, bigHeader, tree, blocks, bitfield, verifier, opts.sessions || [], legacy, opts.onupdate || noop, opts.onconflict || noop)
|
|
198
|
+
return new this(header, compat, crypto, oplog, bigHeader, tree, blocks, bitfield, verifier, opts.sessions || [], legacy, opts.globalCache || null, opts.onupdate || noop, opts.onconflict || noop)
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
async audit () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypercore",
|
|
3
|
-
"version": "10.37.
|
|
3
|
+
"version": "10.37.11",
|
|
4
4
|
"description": "Hypercore is a secure, distributed append-only log",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"brittle": "^3.0.0",
|
|
70
70
|
"hyperswarm": "^4.3.6",
|
|
71
|
+
"rache": "^1.0.0",
|
|
71
72
|
"random-access-memory": "^6.1.0",
|
|
72
73
|
"random-access-memory-overlay": "^3.0.0",
|
|
73
74
|
"range-parser": "^1.2.1",
|