rocksdb-native 3.9.0 → 3.9.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/CMakeLists.txt +3 -3
- package/README.md +3 -0
- package/index.js +1 -2
- package/lib/batch.js +9 -39
- package/lib/iterator.js +3 -6
- package/lib/state.js +3 -14
- package/package.json +6 -5
- package/prebuilds/android-arm/rocksdb-native.bare +0 -0
- package/prebuilds/android-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/android-ia32/rocksdb-native.bare +0 -0
- package/prebuilds/android-x64/rocksdb-native.bare +0 -0
- 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/ios-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/ios-arm64-simulator/rocksdb-native.bare +0 -0
- package/prebuilds/ios-x64-simulator/rocksdb-native.bare +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-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/win32-arm64/rocksdb-native.node +0 -0
- package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
- package/prebuilds/win32-x64/rocksdb-native.node +0 -0
package/CMakeLists.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION
|
|
1
|
+
cmake_minimum_required(VERSION 4.0)
|
|
2
2
|
|
|
3
3
|
find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
|
|
4
4
|
find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
|
|
@@ -9,8 +9,8 @@ project(rocksdb_native C CXX)
|
|
|
9
9
|
|
|
10
10
|
bare_target(target)
|
|
11
11
|
|
|
12
|
-
fetch_package("github:holepunchto/librocksdb#
|
|
13
|
-
fetch_package("github:holepunchto/libjstl#
|
|
12
|
+
fetch_package("github:holepunchto/librocksdb#3aaa9dc")
|
|
13
|
+
fetch_package("github:holepunchto/libjstl#098664c")
|
|
14
14
|
|
|
15
15
|
add_bare_module(rocksdb_native_bare)
|
|
16
16
|
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -213,6 +213,5 @@ exports.BloomFilterPolicy = BloomFilterPolicy
|
|
|
213
213
|
exports.RibbonFilterPolicy = RibbonFilterPolicy
|
|
214
214
|
|
|
215
215
|
function maybeClosed(db) {
|
|
216
|
-
if (db._state.closing || db._index === -1)
|
|
217
|
-
throw new Error('RocksDB session is closed')
|
|
216
|
+
if (db._state.closing || db._index === -1) throw new Error('RocksDB session is closed')
|
|
218
217
|
}
|
package/lib/batch.js
CHANGED
|
@@ -224,9 +224,7 @@ exports.ReadBatch = class RocksDBReadBatch extends RocksDBBatch {
|
|
|
224
224
|
|
|
225
225
|
promise.reject(new Error(err))
|
|
226
226
|
} else {
|
|
227
|
-
promise.resolve(
|
|
228
|
-
values[i] ? this._decodeValue(Buffer.from(values[i])) : null
|
|
229
|
-
)
|
|
227
|
+
promise.resolve(values[i] ? this._decodeValue(Buffer.from(values[i])) : null)
|
|
230
228
|
}
|
|
231
229
|
}
|
|
232
230
|
|
|
@@ -238,9 +236,7 @@ exports.ReadBatch = class RocksDBReadBatch extends RocksDBBatch {
|
|
|
238
236
|
|
|
239
237
|
const promise = new Promise(this._enqueuePromise)
|
|
240
238
|
|
|
241
|
-
this._operations.push(
|
|
242
|
-
new RocksDBGet(this._encodeKey(key), this._db._columnFamily)
|
|
243
|
-
)
|
|
239
|
+
this._operations.push(new RocksDBGet(this._encodeKey(key), this._db._columnFamily))
|
|
244
240
|
|
|
245
241
|
this._resize()
|
|
246
242
|
|
|
@@ -270,13 +266,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
270
266
|
if (this._destroyed) return
|
|
271
267
|
|
|
272
268
|
try {
|
|
273
|
-
binding.write(
|
|
274
|
-
this._db._state._handle,
|
|
275
|
-
this._handle,
|
|
276
|
-
this._operations,
|
|
277
|
-
this,
|
|
278
|
-
this._onwrite
|
|
279
|
-
)
|
|
269
|
+
binding.write(this._db._state._handle, this._handle, this._operations, this, this._onwrite)
|
|
280
270
|
} catch (err) {
|
|
281
271
|
this._db._state.io.dec()
|
|
282
272
|
throw err
|
|
@@ -308,11 +298,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
308
298
|
const promise = new Promise(this._enqueuePromise)
|
|
309
299
|
|
|
310
300
|
this._operations.push(
|
|
311
|
-
new RocksDBPut(
|
|
312
|
-
this._encodeKey(key),
|
|
313
|
-
this._encodeValue(value),
|
|
314
|
-
this._db._columnFamily
|
|
315
|
-
)
|
|
301
|
+
new RocksDBPut(this._encodeKey(key), this._encodeValue(value), this._db._columnFamily)
|
|
316
302
|
)
|
|
317
303
|
|
|
318
304
|
this._resize()
|
|
@@ -324,11 +310,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
324
310
|
if (this._request) throw new Error('Request already in progress')
|
|
325
311
|
|
|
326
312
|
this._operations.push(
|
|
327
|
-
new RocksDBPut(
|
|
328
|
-
this._encodeKey(key),
|
|
329
|
-
this._encodeValue(value),
|
|
330
|
-
this._db._columnFamily
|
|
331
|
-
)
|
|
313
|
+
new RocksDBPut(this._encodeKey(key), this._encodeValue(value), this._db._columnFamily)
|
|
332
314
|
)
|
|
333
315
|
|
|
334
316
|
this._promises.push(null)
|
|
@@ -341,9 +323,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
341
323
|
|
|
342
324
|
const promise = new Promise(this._enqueuePromise)
|
|
343
325
|
|
|
344
|
-
this._operations.push(
|
|
345
|
-
new RocksDBDelete(this._encodeKey(key), this._db._columnFamily)
|
|
346
|
-
)
|
|
326
|
+
this._operations.push(new RocksDBDelete(this._encodeKey(key), this._db._columnFamily))
|
|
347
327
|
|
|
348
328
|
this._resize()
|
|
349
329
|
|
|
@@ -353,9 +333,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
353
333
|
tryDelete(key) {
|
|
354
334
|
if (this._request) throw new Error('Request already in progress')
|
|
355
335
|
|
|
356
|
-
this._operations.push(
|
|
357
|
-
new RocksDBDelete(this._encodeKey(key), this._db._columnFamily)
|
|
358
|
-
)
|
|
336
|
+
this._operations.push(new RocksDBDelete(this._encodeKey(key), this._db._columnFamily))
|
|
359
337
|
|
|
360
338
|
this._promises.push(null)
|
|
361
339
|
|
|
@@ -368,11 +346,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
368
346
|
const promise = new Promise(this._enqueuePromise)
|
|
369
347
|
|
|
370
348
|
this._operations.push(
|
|
371
|
-
new RocksDBDeleteRange(
|
|
372
|
-
this._encodeKey(start),
|
|
373
|
-
this._encodeKey(end),
|
|
374
|
-
this._db._columnFamily
|
|
375
|
-
)
|
|
349
|
+
new RocksDBDeleteRange(this._encodeKey(start), this._encodeKey(end), this._db._columnFamily)
|
|
376
350
|
)
|
|
377
351
|
|
|
378
352
|
this._resize()
|
|
@@ -384,11 +358,7 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
384
358
|
if (this._request) throw new Error('Request already in progress')
|
|
385
359
|
|
|
386
360
|
this._operations.push(
|
|
387
|
-
new RocksDBDeleteRange(
|
|
388
|
-
this._encodeKey(start),
|
|
389
|
-
this._encodeKey(end),
|
|
390
|
-
this._db._columnFamily
|
|
391
|
-
)
|
|
361
|
+
new RocksDBDeleteRange(this._encodeKey(start), this._encodeKey(end), this._db._columnFamily)
|
|
392
362
|
)
|
|
393
363
|
|
|
394
364
|
this._promises.push(null)
|
package/lib/iterator.js
CHANGED
|
@@ -186,21 +186,18 @@ module.exports = class RocksDBIterator extends Readable {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
_encodeKey(k) {
|
|
189
|
-
if (this._db._keyEncoding !== null)
|
|
190
|
-
return c.encode(this._db._keyEncoding, k)
|
|
189
|
+
if (this._db._keyEncoding !== null) return c.encode(this._db._keyEncoding, k)
|
|
191
190
|
if (typeof k === 'string') return Buffer.from(k)
|
|
192
191
|
return k
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
_decodeKey(b) {
|
|
196
|
-
if (this._db._keyEncoding !== null)
|
|
197
|
-
return c.decode(this._db._keyEncoding, b)
|
|
195
|
+
if (this._db._keyEncoding !== null) return c.decode(this._db._keyEncoding, b)
|
|
198
196
|
return b
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
_decodeValue(b) {
|
|
202
|
-
if (this._db._valueEncoding !== null)
|
|
203
|
-
return c.decode(this._db._valueEncoding, b)
|
|
200
|
+
if (this._db._valueEncoding !== null) return c.decode(this._db._valueEncoding, b)
|
|
204
201
|
return b
|
|
205
202
|
}
|
|
206
203
|
}
|
package/lib/state.js
CHANGED
|
@@ -49,9 +49,7 @@ module.exports = class RocksDBState extends ReadyResource {
|
|
|
49
49
|
|
|
50
50
|
for (const columnFamily of columnFamilies) {
|
|
51
51
|
this.columnFamilies.push(
|
|
52
|
-
typeof columnFamily === 'string'
|
|
53
|
-
? new ColumnFamily(columnFamily, opts)
|
|
54
|
-
: columnFamily
|
|
52
|
+
typeof columnFamily === 'string' ? new ColumnFamily(columnFamily, opts) : columnFamily
|
|
55
53
|
)
|
|
56
54
|
}
|
|
57
55
|
|
|
@@ -222,12 +220,7 @@ module.exports = class RocksDBState extends ReadyResource {
|
|
|
222
220
|
})
|
|
223
221
|
|
|
224
222
|
try {
|
|
225
|
-
req.handle = binding.flush(
|
|
226
|
-
this._handle,
|
|
227
|
-
db._columnFamily._handle,
|
|
228
|
-
req,
|
|
229
|
-
onflush
|
|
230
|
-
)
|
|
223
|
+
req.handle = binding.flush(this._handle, db._columnFamily._handle, req, onflush)
|
|
231
224
|
|
|
232
225
|
await promise
|
|
233
226
|
} finally {
|
|
@@ -361,11 +354,7 @@ module.exports = class RocksDBState extends ReadyResource {
|
|
|
361
354
|
|
|
362
355
|
this.io.inc()
|
|
363
356
|
|
|
364
|
-
const {
|
|
365
|
-
includeMemtables = false,
|
|
366
|
-
includeFiles = true,
|
|
367
|
-
filesSizeErrorMargin = -1
|
|
368
|
-
} = opts
|
|
357
|
+
const { includeMemtables = false, includeFiles = true, filesSizeErrorMargin = -1 } = opts
|
|
369
358
|
|
|
370
359
|
const req = { resolve: null, reject: null, handle: null }
|
|
371
360
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rocksdb-native",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "librocksdb bindings for JavaScript",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
],
|
|
18
18
|
"addon": true,
|
|
19
19
|
"scripts": {
|
|
20
|
+
"format": "prettier --write .",
|
|
21
|
+
"lint": "prettier --check .",
|
|
20
22
|
"test": "npm run lint && npm run test:bare && npm run test:node",
|
|
21
23
|
"test:bare": "bare test.js",
|
|
22
|
-
"test:node": "node test.js"
|
|
23
|
-
"lint": "prettier . --check"
|
|
24
|
+
"test:node": "node test.js"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"cmake-bare": "^1.1.14",
|
|
51
52
|
"cmake-fetch": "^1.0.1",
|
|
52
53
|
"cmake-napi": "^1.0.6",
|
|
53
|
-
"prettier": "^3.
|
|
54
|
-
"prettier-config-
|
|
54
|
+
"prettier": "^3.6.2",
|
|
55
|
+
"prettier-config-holepunch": "^2.0.0"
|
|
55
56
|
}
|
|
56
57
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|