rocksdb-native 2.5.0 → 2.6.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.
- package/index.js +26 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-arm64/rocksdb-native.node +0 -0
- package/prebuilds/darwin-x64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-x64/rocksdb-native.node +0 -0
- package/prebuilds/linux-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/linux-arm64/rocksdb-native.node +0 -0
- package/prebuilds/linux-x64/rocksdb-native.bare +0 -0
- package/prebuilds/linux-x64/rocksdb-native.node +0 -0
- package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
- package/prebuilds/win32-x64/rocksdb-native.node +0 -0
package/index.js
CHANGED
|
@@ -43,6 +43,8 @@ const RocksDB = module.exports = class RocksDB extends ReadyResource {
|
|
|
43
43
|
this._snapshots = new Set()
|
|
44
44
|
this._refs = 0
|
|
45
45
|
this._resolvePreclose = null
|
|
46
|
+
this._resolveOnIdle = null
|
|
47
|
+
this._idlePromise = null
|
|
46
48
|
|
|
47
49
|
this._handle = binding.init()
|
|
48
50
|
}
|
|
@@ -121,13 +123,36 @@ const RocksDB = module.exports = class RocksDB extends ReadyResource {
|
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
_decRef () {
|
|
124
|
-
if (--this._refs
|
|
126
|
+
if (--this._refs !== 0) return
|
|
127
|
+
|
|
128
|
+
if (this._resolveOnIdle !== null) {
|
|
129
|
+
const resolve = this._resolveOnIdle
|
|
130
|
+
this._resolveOnIdle = null
|
|
131
|
+
this._idlePromise = null
|
|
132
|
+
resolve()
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (this._resolvePreclose !== null) {
|
|
125
136
|
const resolve = this._resolvePreclose
|
|
126
137
|
this._resolvePreclose = null
|
|
127
138
|
resolve()
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
141
|
|
|
142
|
+
isIdle () {
|
|
143
|
+
return this._refs === 0
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
idle () {
|
|
147
|
+
if (this.isIdle()) return Promise.resolve()
|
|
148
|
+
|
|
149
|
+
if (!this._idlePromise) {
|
|
150
|
+
this._idlePromise = new Promise(resolve => { this._resolveOnIdle = resolve })
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this._idlePromise
|
|
154
|
+
}
|
|
155
|
+
|
|
131
156
|
snapshot (opts) {
|
|
132
157
|
return new Snapshot(this, opts)
|
|
133
158
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|