@nxtedition/rocksdb 12.2.0 → 12.2.3
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
|
@@ -283,8 +283,7 @@ struct BaseIterator : public Closable {
|
|
|
283
283
|
const std::optional<std::string>& gt,
|
|
284
284
|
const std::optional<std::string>& gte,
|
|
285
285
|
const int limit,
|
|
286
|
-
|
|
287
|
-
bool tailing = false)
|
|
286
|
+
rocksdb::ReadOptions readOptions = {})
|
|
288
287
|
: database_(database), column_(column), reverse_(reverse), limit_(limit) {
|
|
289
288
|
if (lte) {
|
|
290
289
|
upper_bound_ = rocksdb::PinnableSlice();
|
|
@@ -306,8 +305,6 @@ struct BaseIterator : public Closable {
|
|
|
306
305
|
lower_bound_->PinSelf();
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
rocksdb::ReadOptions readOptions;
|
|
310
|
-
|
|
311
308
|
if (upper_bound_) {
|
|
312
309
|
readOptions.iterate_upper_bound = &*upper_bound_;
|
|
313
310
|
}
|
|
@@ -316,11 +313,6 @@ struct BaseIterator : public Closable {
|
|
|
316
313
|
readOptions.iterate_lower_bound = &*lower_bound_;
|
|
317
314
|
}
|
|
318
315
|
|
|
319
|
-
readOptions.fill_cache = fillCache;
|
|
320
|
-
readOptions.async_io = true;
|
|
321
|
-
readOptions.adaptive_readahead = true;
|
|
322
|
-
readOptions.tailing = tailing;
|
|
323
|
-
|
|
324
316
|
iterator_.reset(database_->db->NewIterator(readOptions, column_));
|
|
325
317
|
|
|
326
318
|
if (reverse_) {
|
|
@@ -430,12 +422,11 @@ class Iterator final : public BaseIterator {
|
|
|
430
422
|
const std::optional<std::string>& lte,
|
|
431
423
|
const std::optional<std::string>& gt,
|
|
432
424
|
const std::optional<std::string>& gte,
|
|
433
|
-
const bool fillCache,
|
|
434
425
|
const size_t highWaterMarkBytes,
|
|
435
|
-
bool tailing = false,
|
|
436
426
|
Encoding keyEncoding = Encoding::Invalid,
|
|
437
|
-
Encoding valueEncoding = Encoding::Invalid
|
|
438
|
-
|
|
427
|
+
Encoding valueEncoding = Encoding::Invalid,
|
|
428
|
+
rocksdb::ReadOptions readOptions = {})
|
|
429
|
+
: BaseIterator(database, column, reverse, lt, lte, gt, gte, limit, readOptions),
|
|
439
430
|
keys_(keys),
|
|
440
431
|
values_(values),
|
|
441
432
|
highWaterMarkBytes_(highWaterMarkBytes),
|
|
@@ -460,16 +451,10 @@ class Iterator final : public BaseIterator {
|
|
|
460
451
|
bool values = true;
|
|
461
452
|
NAPI_STATUS_THROWS(GetProperty(env, options, "values", values));
|
|
462
453
|
|
|
463
|
-
bool tailing = false;
|
|
464
|
-
NAPI_STATUS_THROWS(GetProperty(env, options, "tailing", tailing));
|
|
465
|
-
|
|
466
|
-
bool fillCache = false;
|
|
467
|
-
NAPI_STATUS_THROWS(GetProperty(env, options, "fillCache", fillCache));
|
|
468
|
-
|
|
469
454
|
int32_t limit = -1;
|
|
470
455
|
NAPI_STATUS_THROWS(GetProperty(env, options, "limit", limit));
|
|
471
456
|
|
|
472
|
-
int32_t highWaterMarkBytes =
|
|
457
|
+
int32_t highWaterMarkBytes = std::numeric_limits<int32_t>::max();
|
|
473
458
|
NAPI_STATUS_THROWS(GetProperty(env, options, "highWaterMarkBytes", highWaterMarkBytes));
|
|
474
459
|
|
|
475
460
|
std::optional<std::string> lt;
|
|
@@ -493,8 +478,41 @@ class Iterator final : public BaseIterator {
|
|
|
493
478
|
Encoding valueEncoding;
|
|
494
479
|
NAPI_STATUS_THROWS(GetProperty(env, options, "valueEncoding", valueEncoding));
|
|
495
480
|
|
|
496
|
-
|
|
497
|
-
|
|
481
|
+
rocksdb::ReadOptions readOptions;
|
|
482
|
+
|
|
483
|
+
readOptions.background_purge_on_iterator_cleanup = true;
|
|
484
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "backgroundPurgeOnIteratorCleanup", readOptions.background_purge_on_iterator_cleanup));
|
|
485
|
+
|
|
486
|
+
readOptions.tailing = false;
|
|
487
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "tailing", readOptions.tailing));
|
|
488
|
+
|
|
489
|
+
readOptions.fill_cache = false;
|
|
490
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "fillCache", readOptions.fill_cache));
|
|
491
|
+
|
|
492
|
+
readOptions.async_io = true;
|
|
493
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "asyncIO", readOptions.async_io));
|
|
494
|
+
|
|
495
|
+
readOptions.adaptive_readahead = true;
|
|
496
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "adaptiveReadahead", readOptions.adaptive_readahead));
|
|
497
|
+
|
|
498
|
+
readOptions.readahead_size = 0;
|
|
499
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "readaheadSize", readOptions.readahead_size));
|
|
500
|
+
|
|
501
|
+
readOptions.auto_readahead_size = true;
|
|
502
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "autoReadaheadSize", readOptions.auto_readahead_size));
|
|
503
|
+
|
|
504
|
+
readOptions.ignore_range_deletions = false;
|
|
505
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "ignoreRangeDeletions", readOptions.ignore_range_deletions));
|
|
506
|
+
|
|
507
|
+
uint32_t timeout = 0;
|
|
508
|
+
NAPI_STATUS_THROWS(GetProperty(env, options, "timeout", timeout));
|
|
509
|
+
|
|
510
|
+
readOptions.deadline = timeout
|
|
511
|
+
? std::chrono::microseconds(database->db->GetEnv()->NowMicros() + timeout * 1000)
|
|
512
|
+
: std::chrono::microseconds::zero();
|
|
513
|
+
|
|
514
|
+
return std::make_unique<Iterator>(database, column, reverse, keys, values, limit, lt, lte, gt, gte,
|
|
515
|
+
highWaterMarkBytes, keyEncoding, valueEncoding, readOptions);
|
|
498
516
|
}
|
|
499
517
|
|
|
500
518
|
napi_value nextv(napi_env env, uint32_t count, napi_value callback) {
|
|
@@ -518,6 +536,10 @@ class Iterator final : public BaseIterator {
|
|
|
518
536
|
first_ = false;
|
|
519
537
|
}
|
|
520
538
|
|
|
539
|
+
if (Status().IsTimedOut()) {
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
|
|
521
543
|
ROCKS_STATUS_RETURN(Status());
|
|
522
544
|
|
|
523
545
|
if (!Valid() || !Increment()) {
|
|
@@ -614,6 +636,10 @@ class Iterator final : public BaseIterator {
|
|
|
614
636
|
first_ = false;
|
|
615
637
|
}
|
|
616
638
|
|
|
639
|
+
if (Status().IsTimedOut()) {
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
|
|
617
643
|
ROCKS_STATUS_THROWS_NAPI(Status());
|
|
618
644
|
|
|
619
645
|
if (!Valid() || !Increment()) {
|
|
@@ -1327,7 +1353,7 @@ NAPI_METHOD(db_clear) {
|
|
|
1327
1353
|
// TODO (fix): Error handling.
|
|
1328
1354
|
// TODO (fix): This should be async...
|
|
1329
1355
|
|
|
1330
|
-
BaseIterator it(database, column, reverse, lt, lte, gt, gte, limit
|
|
1356
|
+
BaseIterator it(database, column, reverse, lt, lte, gt, gte, limit);
|
|
1331
1357
|
|
|
1332
1358
|
rocksdb::WriteBatch batch;
|
|
1333
1359
|
rocksdb::WriteOptions writeOptions;
|
package/deps/rocksdb/rocksdb.gyp
CHANGED
|
@@ -70,7 +70,8 @@
|
|
|
70
70
|
"ccflags": [
|
|
71
71
|
"-fno-omit-frame-pointer",
|
|
72
72
|
"-momit-leaf-frame-pointer",
|
|
73
|
-
"-fno-builtin-memcmp"
|
|
73
|
+
"-fno-builtin-memcmp",
|
|
74
|
+
"-fcoroutines",
|
|
74
75
|
],
|
|
75
76
|
"cflags": ["-std=c++20", "-march=znver1"],
|
|
76
77
|
"cflags!": ["-fno-rtti"],
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"ROCKSDB_SCHED_GETCPU_PRESENT=1",
|
|
91
92
|
"ROCKSDB_IOURING_PRESENT=1",
|
|
92
93
|
"USE_FOLLY=1",
|
|
94
|
+
"USE_COROUTINES=1",
|
|
93
95
|
"HAVE_UINT128_EXTENSION=1",
|
|
94
96
|
"HAVE_ALIGNED_NEW=1",
|
|
95
97
|
# "HAVE_FULLFSYNC=1",
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/util.h
CHANGED
|
@@ -202,22 +202,45 @@ static napi_status GetValue(napi_env env, napi_value value, bool& result) {
|
|
|
202
202
|
return napi_get_value_bool(env, value, &result);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
static napi_status GetValue(napi_env env, napi_value value,
|
|
206
|
-
|
|
205
|
+
static napi_status GetValue(napi_env env, napi_value value, int& result) {
|
|
206
|
+
int64_t result2;
|
|
207
|
+
NAPI_STATUS_RETURN(napi_get_value_int64(env, value, &result2));
|
|
208
|
+
result = static_cast<int>(result2);
|
|
209
|
+
return napi_ok;
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
static napi_status GetValue(napi_env env, napi_value value,
|
|
210
|
-
|
|
212
|
+
static napi_status GetValue(napi_env env, napi_value value, long& result) {
|
|
213
|
+
int64_t result2;
|
|
214
|
+
NAPI_STATUS_RETURN(napi_get_value_int64(env, value, &result2));
|
|
215
|
+
result = static_cast<long>(result2);
|
|
216
|
+
return napi_ok;
|
|
211
217
|
}
|
|
212
218
|
|
|
213
|
-
static napi_status GetValue(napi_env env, napi_value value,
|
|
214
|
-
|
|
219
|
+
static napi_status GetValue(napi_env env, napi_value value, long long& result) {
|
|
220
|
+
int64_t result2;
|
|
221
|
+
NAPI_STATUS_RETURN(napi_get_value_int64(env, value, &result2));
|
|
222
|
+
result = static_cast<long long>(result2);
|
|
223
|
+
return napi_ok;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static napi_status GetValue(napi_env env, napi_value value, unsigned int& result) {
|
|
227
|
+
int64_t result2;
|
|
228
|
+
NAPI_STATUS_RETURN(napi_get_value_int64(env, value, &result2));
|
|
229
|
+
result = static_cast<unsigned int>(result2);
|
|
230
|
+
return napi_ok;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
static napi_status GetValue(napi_env env, napi_value value, unsigned long& result) {
|
|
234
|
+
int64_t result2;
|
|
235
|
+
NAPI_STATUS_RETURN(napi_get_value_int64(env, value, &result2));
|
|
236
|
+
result = static_cast<unsigned long>(result2);
|
|
237
|
+
return napi_ok;
|
|
215
238
|
}
|
|
216
239
|
|
|
217
|
-
static napi_status GetValue(napi_env env, napi_value value,
|
|
240
|
+
static napi_status GetValue(napi_env env, napi_value value, unsigned long long& result) {
|
|
218
241
|
int64_t result2;
|
|
219
242
|
NAPI_STATUS_RETURN(napi_get_value_int64(env, value, &result2));
|
|
220
|
-
result = static_cast<
|
|
243
|
+
result = static_cast<unsigned long long>(result2);
|
|
221
244
|
return napi_ok;
|
|
222
245
|
}
|
|
223
246
|
|