@nxtedition/rocksdb 13.1.3 → 13.1.4

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
@@ -898,6 +898,7 @@ napi_status InitOptions(napi_env env, T& columnOptions, const U& options) {
898
898
  }
899
899
 
900
900
  NAPI_STATUS_RETURN(GetProperty(env, options, "optimizeFiltersForHits", columnOptions.optimize_filters_for_hits));
901
+ NAPI_STATUS_RETURN(GetProperty(env, options, "periodicCompactionSeconds", columnOptions.periodic_compaction_seconds));
901
902
 
902
903
  rocksdb::BlockBasedTableOptions tableOptions;
903
904
  tableOptions.decouple_partitioned_filters = true;
@@ -1081,6 +1082,8 @@ NAPI_METHOD(db_open) {
1081
1082
 
1082
1083
  NAPI_STATUS_THROWS(GetProperty(env, options, "strictBytesPerSync", dbOptions.strict_bytes_per_sync));
1083
1084
 
1085
+ NAPI_STATUS_THROWS(GetProperty(env, options, "delayedWriteRate", dbOptions.delayed_write_rate));
1086
+
1084
1087
  NAPI_STATUS_THROWS(GetProperty(env, options, "createIfMissing", dbOptions.create_if_missing));
1085
1088
 
1086
1089
  NAPI_STATUS_THROWS(GetProperty(env, options, "errorIfExists", dbOptions.error_if_exists));
@@ -1228,18 +1231,12 @@ NAPI_METHOD(db_get_many_sync) {
1228
1231
  uint32_t count;
1229
1232
  NAPI_STATUS_THROWS(napi_get_array_length(env, argv[1], &count));
1230
1233
 
1231
- bool fillCache = true;
1232
- NAPI_STATUS_THROWS(GetProperty(env, argv[2], "fillCache", fillCache));
1233
-
1234
1234
  rocksdb::ColumnFamilyHandle* column = database->db->DefaultColumnFamily();
1235
1235
  NAPI_STATUS_THROWS(GetProperty(env, argv[2], "column", column));
1236
1236
 
1237
1237
  Encoding valueEncoding = Encoding::Buffer;
1238
1238
  NAPI_STATUS_THROWS(GetProperty(env, argv[2], "valueEncoding", valueEncoding));
1239
1239
 
1240
- int32_t highWaterMarkBytes = std::numeric_limits<int32_t>::max();
1241
- NAPI_STATUS_THROWS(GetProperty(env, argv[2], "highWaterMarkBytes", highWaterMarkBytes));
1242
-
1243
1240
  uint32_t timeout = 0;
1244
1241
  NAPI_STATUS_THROWS(GetProperty(env, argv[2], "timeout", timeout));
1245
1242
 
@@ -1260,14 +1257,22 @@ NAPI_METHOD(db_get_many_sync) {
1260
1257
  }
1261
1258
 
1262
1259
  rocksdb::ReadOptions readOptions;
1263
- readOptions.fill_cache = fillCache;
1264
- readOptions.async_io = true;
1265
- readOptions.optimize_multiget_for_io = true;
1266
- readOptions.value_size_soft_limit = highWaterMarkBytes;
1267
1260
  readOptions.deadline = timeout
1268
1261
  ? std::chrono::microseconds(database->db->GetEnv()->NowMicros() + timeout * 1000)
1269
1262
  : std::chrono::microseconds::zero();
1270
1263
 
1264
+ readOptions.fill_cache = false;
1265
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "fillCache", readOptions.fill_cache));
1266
+
1267
+ readOptions.async_io = true;
1268
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "asyncIO", readOptions.async_io));
1269
+
1270
+ readOptions.optimize_multiget_for_io = true;
1271
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "optimizeMultigetForIO", readOptions.optimize_multiget_for_io));
1272
+
1273
+ readOptions.value_size_soft_limit = std::numeric_limits<int32_t>::max();
1274
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "highWaterMarkBytes", readOptions.value_size_soft_limit));
1275
+
1271
1276
  database->db->MultiGet(readOptions, column, count, keys.data(), values.data(), statuses.data());
1272
1277
 
1273
1278
  napi_value rows;
@@ -1302,24 +1307,19 @@ NAPI_METHOD(db_get_many) {
1302
1307
  uint32_t count;
1303
1308
  NAPI_STATUS_THROWS(napi_get_array_length(env, argv[1], &count));
1304
1309
 
1305
- bool fillCache = true;
1306
- NAPI_STATUS_THROWS(GetProperty(env, argv[2], "fillCache", fillCache));
1307
-
1308
1310
  rocksdb::ColumnFamilyHandle* column = database->db->DefaultColumnFamily();
1309
1311
  NAPI_STATUS_THROWS(GetProperty(env, argv[2], "column", column));
1310
1312
 
1311
1313
  Encoding valueEncoding = Encoding::Buffer;
1312
1314
  NAPI_STATUS_THROWS(GetProperty(env, argv[2], "valueEncoding", valueEncoding));
1313
1315
 
1314
- int32_t highWaterMarkBytes = std::numeric_limits<int32_t>::max();
1315
- NAPI_STATUS_THROWS(GetProperty(env, argv[2], "highWaterMarkBytes", highWaterMarkBytes));
1316
-
1317
1316
  bool unsafe = false;
1318
1317
  NAPI_STATUS_THROWS(GetProperty(env, argv[2], "unsafe", unsafe));
1319
1318
 
1320
1319
  auto callback = argv[3];
1321
1320
 
1322
1321
  struct State {
1322
+ rocksdb::ReadOptions readOptions;
1323
1323
  std::vector<rocksdb::Status> statuses;
1324
1324
  std::vector<rocksdb::PinnableSlice> values;
1325
1325
  std::vector<rocksdb::PinnableSlice> keys;
@@ -1333,15 +1333,21 @@ NAPI_METHOD(db_get_many) {
1333
1333
  NAPI_STATUS_THROWS(GetValue(env, element, state.keys[n]));
1334
1334
  }
1335
1335
 
1336
+ state.readOptions.fill_cache = false;
1337
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "fillCache", state.readOptions.fill_cache));
1338
+
1339
+ state.readOptions.async_io = true;
1340
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "asyncIO", state.readOptions.async_io));
1341
+
1342
+ state.readOptions.optimize_multiget_for_io = true;
1343
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "optimizeMultigetForIO", state.readOptions.optimize_multiget_for_io));
1344
+
1345
+ state.readOptions.value_size_soft_limit = std::numeric_limits<int32_t>::max();
1346
+ NAPI_STATUS_THROWS(GetProperty(env, argv[2], "highWaterMarkBytes", state.readOptions.value_size_soft_limit));
1347
+
1336
1348
  runAsync(std::move(state),
1337
1349
  "leveldown.get_many", env, callback,
1338
1350
  [=](auto& state) {
1339
- rocksdb::ReadOptions readOptions;
1340
- readOptions.fill_cache = fillCache;
1341
- readOptions.async_io = true;
1342
- readOptions.optimize_multiget_for_io = true;
1343
- readOptions.value_size_soft_limit = highWaterMarkBytes;
1344
-
1345
1351
  std::vector<rocksdb::Slice> keys;
1346
1352
  keys.reserve(count);
1347
1353
  for (uint32_t n = 0; n < count; n++) {
@@ -1351,7 +1357,7 @@ NAPI_METHOD(db_get_many) {
1351
1357
  state.statuses.resize(count);
1352
1358
  state.values.resize(count);
1353
1359
 
1354
- database->db->MultiGet(readOptions, column, count, keys.data(), state.values.data(), state.statuses.data());
1360
+ database->db->MultiGet(state.readOptions, column, count, keys.data(), state.values.data(), state.statuses.data());
1355
1361
 
1356
1362
  return rocksdb::Status::OK();
1357
1363
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "13.1.3",
3
+ "version": "13.1.4",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",