corestore 7.11.1 → 7.12.1

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.
Files changed (2) hide show
  1. package/index.js +8 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -105,7 +105,7 @@ class CoreTracker {
105
105
  store.watchIndex = -1
106
106
  }
107
107
 
108
- resume(id) {
108
+ resume(id, group) {
109
109
  const core = this.map.get(id)
110
110
 
111
111
  if (!core) return null
@@ -119,6 +119,8 @@ class CoreTracker {
119
119
  core.gc = 0
120
120
  }
121
121
 
122
+ if (group) resumeGroup(core, group).catch(noop)
123
+
122
124
  return core
123
125
  }
124
126
 
@@ -349,12 +351,6 @@ class Corestore extends ReadyResource {
349
351
  }
350
352
 
351
353
  async suspend({ log = noop } = {}) {
352
- await log('Flushing db...')
353
- // If readOnly we don't need to flush
354
- if (!this.storage.readOnly) {
355
- await this.storage.db.flush()
356
- await log('Flusing db completed')
357
- }
358
354
  if (!this.shouldSuspend) return
359
355
  await log('Suspending db...')
360
356
  await this.storage.suspend({ log })
@@ -771,3 +767,8 @@ function noop() {}
771
767
  function toHex(discoveryKey) {
772
768
  return b4a.toString(discoveryKey, 'hex')
773
769
  }
770
+
771
+ async function resumeGroup(core, group) {
772
+ await core.opening
773
+ if (!core.header.group) await core.setGroup(group)
774
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.11.1",
3
+ "version": "7.12.1",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [