@nxtedition/rocksdb 11.1.5 → 11.1.8
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,12 +18,12 @@
|
|
|
18
18
|
#include <rocksdb/table.h>
|
|
19
19
|
#include <rocksdb/write_batch.h>
|
|
20
20
|
|
|
21
|
+
#include <boost/regex.hpp>
|
|
21
22
|
|
|
22
23
|
#include <iostream>
|
|
23
24
|
#include <memory>
|
|
24
25
|
#include <optional>
|
|
25
26
|
#include <set>
|
|
26
|
-
#include <regex>
|
|
27
27
|
#include <string>
|
|
28
28
|
#include <thread>
|
|
29
29
|
#include <vector>
|
|
@@ -1488,10 +1488,10 @@ NAPI_METHOD(regex_init) {
|
|
|
1488
1488
|
NAPI_STATUS_THROWS(GetString(env, argv[0], pattern));
|
|
1489
1489
|
|
|
1490
1490
|
try {
|
|
1491
|
-
auto regex = std::make_unique<
|
|
1491
|
+
auto regex = std::make_unique<boost::regex>(pattern, boost::regex::optimize | boost::regex::ECMAScript);
|
|
1492
1492
|
|
|
1493
1493
|
napi_value result;
|
|
1494
|
-
NAPI_STATUS_THROWS(napi_create_external(env, regex.get(), Finalize<
|
|
1494
|
+
NAPI_STATUS_THROWS(napi_create_external(env, regex.get(), Finalize<boost::regex>, regex.get(), &result));
|
|
1495
1495
|
regex.release();
|
|
1496
1496
|
|
|
1497
1497
|
return result;
|
|
@@ -1504,7 +1504,7 @@ NAPI_METHOD(regex_init) {
|
|
|
1504
1504
|
NAPI_METHOD(regex_test) {
|
|
1505
1505
|
NAPI_ARGV(4);
|
|
1506
1506
|
|
|
1507
|
-
|
|
1507
|
+
boost::regex* regex;
|
|
1508
1508
|
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(®ex)));
|
|
1509
1509
|
|
|
1510
1510
|
rocksdb::Slice value;
|
|
@@ -1519,7 +1519,7 @@ NAPI_METHOD(regex_test) {
|
|
|
1519
1519
|
length = std::max(0, std::min<int>(length, value.size() - offset));
|
|
1520
1520
|
|
|
1521
1521
|
try {
|
|
1522
|
-
const bool match =
|
|
1522
|
+
const bool match = boost::regex_search(value.data() + offset, value.data() + offset + length, *regex);
|
|
1523
1523
|
|
|
1524
1524
|
napi_value result;
|
|
1525
1525
|
NAPI_STATUS_THROWS(napi_get_boolean(env, match, &result));
|
|
@@ -1531,42 +1531,6 @@ NAPI_METHOD(regex_test) {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
1533
|
|
|
1534
|
-
NAPI_METHOD(regex_test_many) {
|
|
1535
|
-
NAPI_ARGV(2);
|
|
1536
|
-
|
|
1537
|
-
std::regex* regex;
|
|
1538
|
-
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(®ex)));
|
|
1539
|
-
|
|
1540
|
-
uint32_t count;
|
|
1541
|
-
NAPI_STATUS_THROWS(napi_get_array_length(env, argv[1], &count));
|
|
1542
|
-
|
|
1543
|
-
napi_value result;
|
|
1544
|
-
NAPI_STATUS_THROWS(napi_create_array_with_length(env, count, &result));
|
|
1545
|
-
|
|
1546
|
-
try {
|
|
1547
|
-
for (uint32_t n = 0; n < count; n++) {
|
|
1548
|
-
napi_value valueElement;
|
|
1549
|
-
NAPI_STATUS_THROWS(napi_get_element(env, argv[1], n, &valueElement));
|
|
1550
|
-
|
|
1551
|
-
rocksdb::Slice value;
|
|
1552
|
-
NAPI_STATUS_THROWS(GetValue(env, valueElement, value));
|
|
1553
|
-
|
|
1554
|
-
const bool match = std::regex_search(value.data(), value.data() + value.size(), *regex);
|
|
1555
|
-
|
|
1556
|
-
napi_value matchElement;
|
|
1557
|
-
NAPI_STATUS_THROWS(napi_get_boolean(env, match, &matchElement));
|
|
1558
|
-
|
|
1559
|
-
NAPI_STATUS_THROWS(napi_set_element(env, result, n, matchElement));
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
return result;
|
|
1563
|
-
} catch (const std::exception& e) {
|
|
1564
|
-
napi_throw_error(env, nullptr, e.what());
|
|
1565
|
-
return 0;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
1534
|
NAPI_INIT() {
|
|
1571
1535
|
NAPI_EXPORT_FUNCTION(db_init);
|
|
1572
1536
|
NAPI_EXPORT_FUNCTION(db_open);
|
|
@@ -1596,6 +1560,5 @@ NAPI_INIT() {
|
|
|
1596
1560
|
NAPI_EXPORT_FUNCTION(batch_iterate);
|
|
1597
1561
|
|
|
1598
1562
|
NAPI_EXPORT_FUNCTION(regex_init);
|
|
1599
|
-
NAPI_EXPORT_FUNCTION(regex_test_many);
|
|
1600
1563
|
NAPI_EXPORT_FUNCTION(regex_test);
|
|
1601
1564
|
}
|
package/binding.gyp
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
"targets": [
|
|
4
4
|
{
|
|
5
5
|
"target_name": "leveldown",
|
|
6
|
+
"defines": [
|
|
7
|
+
"BOOST_REGEX_STANDALONE=yes"
|
|
8
|
+
],
|
|
6
9
|
"conditions": [
|
|
7
10
|
[
|
|
8
11
|
"OS == 'linux'",
|
|
@@ -52,7 +55,7 @@
|
|
|
52
55
|
]
|
|
53
56
|
],
|
|
54
57
|
"dependencies": ["<(module_root_dir)/deps/rocksdb/rocksdb.gyp:rocksdb"],
|
|
55
|
-
"include_dirs": ["<!(node -e \"require('napi-macros')\")"],
|
|
58
|
+
"include_dirs": ["<!(node -e \"require('napi-macros')\")", "/opt/homebrew/Cellar/boost/1.86.0/include"],
|
|
56
59
|
"sources": ["binding.cc"]
|
|
57
60
|
}
|
|
58
61
|
]
|
package/deps/rocksdb/rocksdb.gyp
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|