@nxtedition/rocksdb 7.1.11 → 7.1.12
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/binding.cc +5 -3
- package/index.js +6 -0
- package/package.json +1 -1
package/binding.cc
CHANGED
|
@@ -1516,8 +1516,10 @@ NAPI_METHOD(batch_write) {
|
|
|
1516
1516
|
// TODO (fix): Better way to get final batch sequence?
|
|
1517
1517
|
auto seq = database->db->GetLatestSequenceNumber() + 1;
|
|
1518
1518
|
|
|
1519
|
-
napi_value result;
|
|
1520
|
-
|
|
1519
|
+
std::array<napi_value, 2> result;
|
|
1520
|
+
|
|
1521
|
+
NAPI_STATUS_THROWS(napi_get_null(env, &result[0]));
|
|
1522
|
+
NAPI_STATUS_THROWS(napi_create_int64(env, seq, &result[1]));
|
|
1521
1523
|
|
|
1522
1524
|
rocksdb::WriteOptions writeOptions;
|
|
1523
1525
|
ROCKS_STATUS_THROWS_NAPI(database->db->Write(writeOptions, batch));
|
|
@@ -1525,7 +1527,7 @@ NAPI_METHOD(batch_write) {
|
|
|
1525
1527
|
napi_value global;
|
|
1526
1528
|
NAPI_STATUS_THROWS(napi_get_global(env, &global));
|
|
1527
1529
|
|
|
1528
|
-
NAPI_STATUS_THROWS(napi_call_function(env, global, callback,
|
|
1530
|
+
NAPI_STATUS_THROWS(napi_call_function(env, global, callback, result.size(), result.data(), nullptr));
|
|
1529
1531
|
}
|
|
1530
1532
|
|
|
1531
1533
|
return 0;
|
package/index.js
CHANGED
|
@@ -209,6 +209,12 @@ class RocksLevel extends AbstractLevel {
|
|
|
209
209
|
binding.batch_write(this[kContext], context, options, (err, sequence) => {
|
|
210
210
|
this[kUnref]()
|
|
211
211
|
|
|
212
|
+
// TODO (fix): Temporary workaround.
|
|
213
|
+
if (sequence == null && typeof err === 'number') {
|
|
214
|
+
sequence = err
|
|
215
|
+
err = null
|
|
216
|
+
}
|
|
217
|
+
|
|
212
218
|
if (!err) {
|
|
213
219
|
this.emit('update', {
|
|
214
220
|
rows: batch.toArray(),
|