corestore 6.18.1 → 6.18.3
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 +7 -0
- package/package.json +4 -3
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
33
33
|
this.manifestVersion = typeof opts.manifestVersion === 'number' ? opts.manifestVersion : (root ? root.manifestVersion : DEFAULT_MANIFEST)
|
|
34
34
|
this.compat = typeof opts.compat === 'boolean' ? opts.compat : (root ? root.compat : DEFAULT_COMPAT)
|
|
35
35
|
this.inflightRange = opts.inflightRange || null
|
|
36
|
+
this.globalCache = opts.globalCache || null
|
|
36
37
|
|
|
37
38
|
this._keyStorage = null
|
|
38
39
|
this._bootstrap = opts._bootstrap || null
|
|
@@ -319,6 +320,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
319
320
|
key,
|
|
320
321
|
compat: opts.compat,
|
|
321
322
|
cache: opts.cache,
|
|
323
|
+
globalCache: this.globalCache,
|
|
322
324
|
createIfMissing: opts.createIfMissing === false ? false : !opts._discoveryKey,
|
|
323
325
|
keyPair: hasKeyPair ? keyPair : null
|
|
324
326
|
})
|
|
@@ -392,6 +394,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
392
394
|
|
|
393
395
|
const core = new Hypercore(null, {
|
|
394
396
|
...opts,
|
|
397
|
+
globalCache: this.globalCache,
|
|
395
398
|
name: null,
|
|
396
399
|
preload: async () => {
|
|
397
400
|
if (opts.preload) opts = { ...opts, ...(await opts.preload()) }
|
|
@@ -454,11 +457,14 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
454
457
|
})
|
|
455
458
|
|
|
456
459
|
if (!this.passive) {
|
|
460
|
+
const muxer = stream.noiseStream.userData
|
|
461
|
+
muxer.cork()
|
|
457
462
|
for (const core of this.cores.values()) {
|
|
458
463
|
// If the core is not opened, it will be replicated in preload.
|
|
459
464
|
if (!core.opened || core.closing || !core.replicator.downloading) continue
|
|
460
465
|
core.replicate(stream, { session: true })
|
|
461
466
|
}
|
|
467
|
+
stream.noiseStream.opened.then(() => muxer.uncork())
|
|
462
468
|
}
|
|
463
469
|
|
|
464
470
|
const streamRecord = { stream, isExternal }
|
|
@@ -486,6 +492,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
486
492
|
_attached: opts && opts.detach === false ? this : null,
|
|
487
493
|
_root: this._root,
|
|
488
494
|
inflightRange: this.inflightRange,
|
|
495
|
+
globalCache: this.globalCache,
|
|
489
496
|
...opts
|
|
490
497
|
})
|
|
491
498
|
if (this === this._root) this._rootStoreSessions.add(session)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corestore",
|
|
3
|
-
"version": "6.18.
|
|
3
|
+
"version": "6.18.3",
|
|
4
4
|
"description": "A Hypercore factory that simplifies managing collections of cores.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"brittle": "^3.2.2",
|
|
28
28
|
"random-access-memory": "^6.2.0",
|
|
29
29
|
"standard": "^17.1.0",
|
|
30
|
-
"test-tmp": "^1.0.2"
|
|
30
|
+
"test-tmp": "^1.0.2",
|
|
31
|
+
"rache": "^1.0.0"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"b4a": "^1.6.4",
|
|
34
|
-
"hypercore": "^10.
|
|
35
|
+
"hypercore": "^10.37.10",
|
|
35
36
|
"hypercore-crypto": "^3.4.0",
|
|
36
37
|
"hypercore-id-encoding": "^1.2.0",
|
|
37
38
|
"read-write-mutexify": "^2.1.0",
|