@nxtedition/rocksdb 11.0.6 → 11.0.7

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 CHANGED
@@ -1077,37 +1077,38 @@ NAPI_METHOD(db_get_many) {
1077
1077
 
1078
1078
  auto callback = argv[3];
1079
1079
 
1080
- std::vector<rocksdb::PinnableSlice> keys{count};
1080
+ struct State {
1081
+ std::vector<rocksdb::Status> statuses;
1082
+ std::vector<rocksdb::PinnableSlice> values;
1083
+ std::vector<rocksdb::PinnableSlice> keys;
1084
+ } state;
1085
+
1086
+ state.keys.resize(count);
1081
1087
 
1082
1088
  for (uint32_t n = 0; n < count; n++) {
1083
1089
  napi_value element;
1084
1090
  NAPI_STATUS_THROWS(napi_get_element(env, argv[1], n, &element));
1085
- NAPI_STATUS_THROWS(GetValue(env, element, keys[n]));
1091
+ NAPI_STATUS_THROWS(GetValue(env, element, state.keys[n]));
1086
1092
  }
1087
1093
 
1088
- struct State {
1089
- std::vector<rocksdb::Status> statuses;
1090
- std::vector<rocksdb::PinnableSlice> values;
1091
- };
1092
-
1093
- runAsync<State>(
1094
+ runAsync(std::move(state),
1094
1095
  "leveldown.get_many", env, callback,
1095
- [=, keys = std::move(keys)](auto& state) {
1096
- std::vector<rocksdb::Slice> keys2{count};
1097
- for (uint32_t n = 0; n < count; n++) {
1098
- keys2[n] = keys[n];
1099
- }
1100
-
1096
+ [=](auto& state) {
1101
1097
  rocksdb::ReadOptions readOptions;
1102
1098
  readOptions.fill_cache = fillCache;
1103
1099
  readOptions.async_io = true;
1104
1100
  readOptions.optimize_multiget_for_io = true;
1105
1101
  readOptions.value_size_soft_limit = highWaterMarkBytes;
1106
1102
 
1103
+ std::vector<rocksdb::Slice> keys{count};
1104
+ for (uint32_t n = 0; n < count; n++) {
1105
+ keys[n] = state.keys[n];
1106
+ }
1107
+
1107
1108
  state.statuses.resize(count);
1108
1109
  state.values.resize(count);
1109
1110
 
1110
- database->db->MultiGet(readOptions, column, count, keys2.data(), state.values.data(), state.statuses.data());
1111
+ database->db->MultiGet(readOptions, column, count, keys.data(), state.values.data(), state.statuses.data());
1111
1112
 
1112
1113
  return rocksdb::Status::OK();
1113
1114
  },
package/chained-batch.js CHANGED
@@ -72,6 +72,7 @@ class ChainedBatch extends AbstractChainedBatch {
72
72
  }
73
73
 
74
74
  _close (callback) {
75
+ binding.batch_clear(this[kBatchContext])
75
76
  process.nextTick(callback)
76
77
  }
77
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "11.0.6",
3
+ "version": "11.0.7",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",