hypercore-storage 2.0.4 → 2.1.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.
Files changed (2) hide show
  1. package/index.js +11 -6
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -441,14 +441,19 @@ class CorestoreStorage {
441
441
  this.version = 0
442
442
  this.migrating = null
443
443
 
444
- const preopen = this._openDeviceFile()
444
+ if ((this.bootstrap && !this.readOnly && !this.allowBackup) || this.wait) {
445
+ const corestoreFile = path.join(this.path, 'CORESTORE')
445
446
 
446
- this.preopen = preopen
447
- this.rocks =
448
- storage === null ? db : new RocksDB(path.join(this.path, 'db'), { ...opts, preopen })
449
- this.db = createColumnFamily(this.rocks, opts)
447
+ this.deviceFile = new DeviceFile(corestoreFile, {
448
+ wait: this.wait,
449
+ data: { id: this.id }
450
+ })
451
+ }
450
452
 
451
- preopen.catch(noop) // awaited in rocks
453
+ const dbPath = path.join(this.path, 'db')
454
+
455
+ this.rocks = storage === null ? db : new RocksDB(dbPath, { ...opts, lock: this.deviceFile })
456
+ this.db = createColumnFamily(this.rocks, opts)
452
457
  }
453
458
 
454
459
  get opened() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-storage",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",
@@ -33,13 +33,13 @@
33
33
  "bare-fs": "^4.0.1",
34
34
  "bare-path": "^3.0.0",
35
35
  "compact-encoding": "^2.16.0",
36
- "device-file": "^2.0.0",
36
+ "device-file": "^2.1.2",
37
37
  "flat-tree": "^1.12.1",
38
38
  "hypercore-crypto": "^3.4.2",
39
39
  "hyperschema": "^1.7.0",
40
40
  "index-encoder": "^3.3.2",
41
41
  "resolve-reject-promise": "^1.0.0",
42
- "rocksdb-native": "^3.1.1",
42
+ "rocksdb-native": "^3.11.0",
43
43
  "scope-lock": "^1.2.4",
44
44
  "streamx": "^2.21.1"
45
45
  },