@nxtedition/rocksdb 13.1.0 → 13.1.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/binding.cc
CHANGED
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
#include <rocksdb/table.h>
|
|
19
19
|
#include <rocksdb/write_batch.h>
|
|
20
20
|
|
|
21
|
-
#include <re2/re2.h>
|
|
22
|
-
|
|
23
21
|
#include <iostream>
|
|
24
22
|
#include <memory>
|
|
25
23
|
#include <optional>
|
|
@@ -412,7 +410,6 @@ class Iterator final : public BaseIterator {
|
|
|
412
410
|
bool first_ = true;
|
|
413
411
|
const Encoding keyEncoding_;
|
|
414
412
|
const Encoding valueEncoding_;
|
|
415
|
-
std::unique_ptr<re2::RE2> expr_;
|
|
416
413
|
|
|
417
414
|
public:
|
|
418
415
|
Iterator(Database* database,
|
|
@@ -428,18 +425,13 @@ class Iterator final : public BaseIterator {
|
|
|
428
425
|
const size_t highWaterMarkBytes,
|
|
429
426
|
Encoding keyEncoding = Encoding::Invalid,
|
|
430
427
|
Encoding valueEncoding = Encoding::Invalid,
|
|
431
|
-
rocksdb::ReadOptions readOptions = {}
|
|
432
|
-
const std::string& selector = "")
|
|
428
|
+
rocksdb::ReadOptions readOptions = {})
|
|
433
429
|
: BaseIterator(database, column, reverse, lt, lte, gt, gte, limit, readOptions),
|
|
434
430
|
keys_(keys),
|
|
435
431
|
values_(values),
|
|
436
432
|
highWaterMarkBytes_(highWaterMarkBytes),
|
|
437
433
|
keyEncoding_(keyEncoding),
|
|
438
434
|
valueEncoding_(valueEncoding) {
|
|
439
|
-
if (selector != "") {
|
|
440
|
-
// TODO (fix): Pool selectors?
|
|
441
|
-
expr_.reset(new re2::RE2(selector));
|
|
442
|
-
}
|
|
443
435
|
}
|
|
444
436
|
|
|
445
437
|
void Seek(const rocksdb::Slice& target) override {
|
|
@@ -513,9 +505,6 @@ class Iterator final : public BaseIterator {
|
|
|
513
505
|
readOptions.ignore_range_deletions = false;
|
|
514
506
|
NAPI_STATUS_THROWS(GetProperty(env, options, "ignoreRangeDeletions", readOptions.ignore_range_deletions));
|
|
515
507
|
|
|
516
|
-
std::string selector;
|
|
517
|
-
NAPI_STATUS_THROWS(GetProperty(env, options, "selector", selector));
|
|
518
|
-
|
|
519
508
|
// uint32_t timeout = 0;
|
|
520
509
|
// NAPI_STATUS_THROWS(GetProperty(env, options, "timeout", timeout));
|
|
521
510
|
|
|
@@ -524,7 +513,7 @@ class Iterator final : public BaseIterator {
|
|
|
524
513
|
// : std::chrono::microseconds::zero();
|
|
525
514
|
|
|
526
515
|
return std::make_unique<Iterator>(database, column, reverse, keys, values, limit, lt, lte, gt, gte,
|
|
527
|
-
highWaterMarkBytes, keyEncoding, valueEncoding, readOptions
|
|
516
|
+
highWaterMarkBytes, keyEncoding, valueEncoding, readOptions);
|
|
528
517
|
}
|
|
529
518
|
|
|
530
519
|
napi_value nextv(napi_env env, uint32_t count, uint32_t timeout, napi_value callback) {
|
|
@@ -559,28 +548,26 @@ class Iterator final : public BaseIterator {
|
|
|
559
548
|
break;
|
|
560
549
|
}
|
|
561
550
|
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
assert(false);
|
|
581
|
-
}
|
|
582
|
-
state.count += 1;
|
|
551
|
+
if (keys_ && values_) {
|
|
552
|
+
rocksdb::PinnableSlice k;
|
|
553
|
+
k.PinSelf(CurrentKey());
|
|
554
|
+
state.keys.push_back(std::move(k));
|
|
555
|
+
|
|
556
|
+
rocksdb::PinnableSlice v;
|
|
557
|
+
v.PinSelf(CurrentValue());
|
|
558
|
+
state.values.push_back(std::move(v));
|
|
559
|
+
} else if (keys_) {
|
|
560
|
+
rocksdb::PinnableSlice k;
|
|
561
|
+
k.PinSelf(CurrentKey());
|
|
562
|
+
state.keys.push_back(std::move(k));
|
|
563
|
+
} else if (values_) {
|
|
564
|
+
rocksdb::PinnableSlice v;
|
|
565
|
+
v.PinSelf(CurrentValue());
|
|
566
|
+
state.values.push_back(std::move(v));
|
|
567
|
+
} else {
|
|
568
|
+
assert(false);
|
|
583
569
|
}
|
|
570
|
+
state.count += 1;
|
|
584
571
|
|
|
585
572
|
bytesRead += CurrentKey().size() + CurrentValue().size();
|
|
586
573
|
if (bytesRead > highWaterMarkBytes_) {
|
|
@@ -661,31 +648,29 @@ class Iterator final : public BaseIterator {
|
|
|
661
648
|
break;
|
|
662
649
|
}
|
|
663
650
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
napi_value val;
|
|
667
|
-
|
|
668
|
-
if (keys_ && values_) {
|
|
669
|
-
const auto k = CurrentKey();
|
|
670
|
-
const auto v = CurrentValue();
|
|
671
|
-
NAPI_STATUS_THROWS(Convert(env, &k, keyEncoding_, key));
|
|
672
|
-
NAPI_STATUS_THROWS(Convert(env, &v, valueEncoding_, val));
|
|
673
|
-
} else if (keys_) {
|
|
674
|
-
const auto k = CurrentKey();
|
|
675
|
-
NAPI_STATUS_THROWS(Convert(env, &k, keyEncoding_, key));
|
|
676
|
-
NAPI_STATUS_THROWS(napi_get_undefined(env, &val));
|
|
677
|
-
} else if (values_) {
|
|
678
|
-
const auto v = CurrentValue();
|
|
679
|
-
NAPI_STATUS_THROWS(napi_get_undefined(env, &key));
|
|
680
|
-
NAPI_STATUS_THROWS(Convert(env, &v, valueEncoding_, val));
|
|
681
|
-
} else {
|
|
682
|
-
assert(false);
|
|
683
|
-
}
|
|
651
|
+
napi_value key;
|
|
652
|
+
napi_value val;
|
|
684
653
|
|
|
685
|
-
|
|
686
|
-
|
|
654
|
+
if (keys_ && values_) {
|
|
655
|
+
const auto k = CurrentKey();
|
|
656
|
+
const auto v = CurrentValue();
|
|
657
|
+
NAPI_STATUS_THROWS(Convert(env, &k, keyEncoding_, key));
|
|
658
|
+
NAPI_STATUS_THROWS(Convert(env, &v, valueEncoding_, val));
|
|
659
|
+
} else if (keys_) {
|
|
660
|
+
const auto k = CurrentKey();
|
|
661
|
+
NAPI_STATUS_THROWS(Convert(env, &k, keyEncoding_, key));
|
|
662
|
+
NAPI_STATUS_THROWS(napi_get_undefined(env, &val));
|
|
663
|
+
} else if (values_) {
|
|
664
|
+
const auto v = CurrentValue();
|
|
665
|
+
NAPI_STATUS_THROWS(napi_get_undefined(env, &key));
|
|
666
|
+
NAPI_STATUS_THROWS(Convert(env, &v, valueEncoding_, val));
|
|
667
|
+
} else {
|
|
668
|
+
assert(false);
|
|
687
669
|
}
|
|
688
670
|
|
|
671
|
+
NAPI_STATUS_THROWS(napi_set_element(env, rows, idx++, key));
|
|
672
|
+
NAPI_STATUS_THROWS(napi_set_element(env, rows, idx++, val));
|
|
673
|
+
|
|
689
674
|
bytesRead += CurrentKey().size() + CurrentValue().size();
|
|
690
675
|
if (bytesRead > highWaterMarkBytes_) {
|
|
691
676
|
break;
|
package/binding.gyp
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
{
|
|
11
11
|
"direct_dependent_settings": {
|
|
12
12
|
"libraries": [
|
|
13
|
-
"/usr/lib/x86_64-linux-gnu/libre2.a",
|
|
14
13
|
],
|
|
15
14
|
},
|
|
16
15
|
"include_dirs": [
|
|
@@ -29,12 +28,9 @@
|
|
|
29
28
|
{
|
|
30
29
|
"direct_dependent_settings": {
|
|
31
30
|
"libraries": [
|
|
32
|
-
"/opt/homebrew/Cellar/re2/20240702_1/lib/re2.a"
|
|
33
31
|
],
|
|
34
32
|
},
|
|
35
33
|
"include_dirs": [
|
|
36
|
-
"/opt/homebrew/Cellar/re2/20240702_1/include",
|
|
37
|
-
"/opt/homebrew/Cellar/abseil/20240722.0/include"
|
|
38
34
|
],
|
|
39
35
|
"xcode_settings": {
|
|
40
36
|
"WARNING_CFLAGS": [
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|