@nxtedition/rocksdb 8.2.0-alpha.2 → 8.2.0
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 +11 -96
- package/binding.gyp +0 -3
- package/deps/rocksdb/rocksdb.gyp +3 -7
- package/index.js +0 -6
- package/package.json +1 -1
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/deps/liburing/liburing.gyp +0 -20
package/binding.cc
CHANGED
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
#include <rocksdb/table.h>
|
|
19
19
|
#include <rocksdb/write_batch.h>
|
|
20
20
|
|
|
21
|
-
#include <liburing.h>
|
|
22
|
-
#include <sys/uio.h>
|
|
23
|
-
|
|
24
21
|
#include <iostream>
|
|
25
22
|
#include <memory>
|
|
26
23
|
#include <optional>
|
|
@@ -386,7 +383,7 @@ struct BaseIterator : public Closable {
|
|
|
386
383
|
}
|
|
387
384
|
readOptions.fill_cache = fillCache_;
|
|
388
385
|
readOptions.snapshot = snapshot_.get();
|
|
389
|
-
readOptions.async_io = true;
|
|
386
|
+
// readOptions.async_io = true;
|
|
390
387
|
readOptions.adaptive_readahead = true;
|
|
391
388
|
readOptions.tailing = tailing_;
|
|
392
389
|
|
|
@@ -471,33 +468,7 @@ static void FinalizeDatabase(napi_env env, void* data, void* hint) {
|
|
|
471
468
|
}
|
|
472
469
|
}
|
|
473
470
|
|
|
474
|
-
inline void DeleteIOUring(void* p) {
|
|
475
|
-
struct io_uring* iu = static_cast<struct io_uring*>(p);
|
|
476
|
-
delete iu;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
const unsigned int kIoUringDepth = 256;
|
|
480
|
-
inline struct io_uring* CreateIOUring() {
|
|
481
|
-
struct io_uring* new_io_uring = new struct io_uring;
|
|
482
|
-
int ret = io_uring_queue_init(kIoUringDepth, new_io_uring, 0);
|
|
483
|
-
if (ret) {
|
|
484
|
-
delete new_io_uring;
|
|
485
|
-
new_io_uring = nullptr;
|
|
486
|
-
}
|
|
487
|
-
return new_io_uring;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
471
|
NAPI_METHOD(db_init) {
|
|
491
|
-
// Ensure io_uring works.
|
|
492
|
-
{
|
|
493
|
-
io_uring new_io_uring = {};
|
|
494
|
-
auto ret = io_uring_queue_init(256, &new_io_uring, 0);
|
|
495
|
-
if (ret) {
|
|
496
|
-
ROCKS_STATUS_THROWS_NAPI(rocksdb::Status::NotSupported("ioring not supported"));
|
|
497
|
-
}
|
|
498
|
-
io_uring_queue_exit(&new_io_uring);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
472
|
auto database = new Database();
|
|
502
473
|
napi_add_env_cleanup_hook(env, env_cleanup_hook, database);
|
|
503
474
|
|
|
@@ -671,8 +642,8 @@ NAPI_METHOD(db_get_merge_operands) {
|
|
|
671
642
|
Database* database;
|
|
672
643
|
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(&database)));
|
|
673
644
|
|
|
674
|
-
|
|
675
|
-
|
|
645
|
+
std::string key;
|
|
646
|
+
NAPI_STATUS_THROWS(GetValue(env, argv[1], key));
|
|
676
647
|
|
|
677
648
|
const auto options = argv[2];
|
|
678
649
|
|
|
@@ -689,22 +660,16 @@ NAPI_METHOD(db_get_merge_operands) {
|
|
|
689
660
|
[=, key = std::move(key)](auto& values) {
|
|
690
661
|
rocksdb::ReadOptions readOptions;
|
|
691
662
|
|
|
692
|
-
|
|
663
|
+
values.resize(16); // TODO (fix): Make option
|
|
693
664
|
|
|
694
|
-
|
|
695
|
-
|
|
665
|
+
rocksdb::GetMergeOperandsOptions mergeOperandsOptions;
|
|
666
|
+
mergeOperandsOptions.expected_max_number_of_operands = values.size();
|
|
696
667
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
column,
|
|
701
|
-
key,
|
|
702
|
-
values.data(),
|
|
703
|
-
&mergeOperandsOptions,
|
|
704
|
-
&size
|
|
705
|
-
);
|
|
668
|
+
int size = 0;
|
|
669
|
+
const auto status =
|
|
670
|
+
database->db->GetMergeOperands(readOptions, column, key, values.data(), &mergeOperandsOptions, &size);
|
|
706
671
|
|
|
707
|
-
|
|
672
|
+
values.resize(size);
|
|
708
673
|
|
|
709
674
|
return status;
|
|
710
675
|
},
|
|
@@ -944,7 +909,7 @@ NAPI_METHOD(db_get_many) {
|
|
|
944
909
|
rocksdb::ReadOptions readOptions;
|
|
945
910
|
readOptions.fill_cache = fillCache;
|
|
946
911
|
readOptions.snapshot = snapshot.get();
|
|
947
|
-
readOptions.async_io = true;
|
|
912
|
+
// readOptions.async_io = true;
|
|
948
913
|
readOptions.ignore_range_deletions = ignoreRangeDeletions;
|
|
949
914
|
readOptions.optimize_multiget_for_io = true;
|
|
950
915
|
|
|
@@ -1594,55 +1559,6 @@ NAPI_METHOD(batch_iterate) {
|
|
|
1594
1559
|
return result;
|
|
1595
1560
|
}
|
|
1596
1561
|
|
|
1597
|
-
NAPI_METHOD(db_get_sorted_wal_files) {
|
|
1598
|
-
NAPI_ARGV(3);
|
|
1599
|
-
|
|
1600
|
-
Database* database;
|
|
1601
|
-
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(&database)));
|
|
1602
|
-
|
|
1603
|
-
auto callback = argv[1];
|
|
1604
|
-
|
|
1605
|
-
runAsync<rocksdb::VectorLogPtr>(
|
|
1606
|
-
"leveldown.open", env, callback, [=](auto& files) { return database->db->GetSortedWalFiles(files); },
|
|
1607
|
-
[=](auto& files, auto env, auto& argv) {
|
|
1608
|
-
argv.resize(2);
|
|
1609
|
-
|
|
1610
|
-
const auto size = files.size();
|
|
1611
|
-
NAPI_STATUS_RETURN(napi_create_array_with_length(env, size, &argv[1]));
|
|
1612
|
-
|
|
1613
|
-
for (size_t n = 0; n < size; ++n) {
|
|
1614
|
-
napi_value element;
|
|
1615
|
-
NAPI_STATUS_RETURN(napi_create_object(env, &element));
|
|
1616
|
-
|
|
1617
|
-
napi_value pathName;
|
|
1618
|
-
NAPI_STATUS_RETURN(napi_create_string_utf8(env, files[n]->PathName().data(), NAPI_AUTO_LENGTH, &pathName))
|
|
1619
|
-
NAPI_STATUS_RETURN(napi_set_named_property(env, element, "pathName", pathName));
|
|
1620
|
-
|
|
1621
|
-
napi_value logNumber;
|
|
1622
|
-
NAPI_STATUS_RETURN(napi_create_int32(env, files[n]->LogNumber(), &logNumber))
|
|
1623
|
-
NAPI_STATUS_RETURN(napi_set_named_property(env, element, "logNumber", logNumber));
|
|
1624
|
-
|
|
1625
|
-
napi_value type;
|
|
1626
|
-
NAPI_STATUS_RETURN(napi_create_int32(env, files[n]->Type(), &type))
|
|
1627
|
-
NAPI_STATUS_RETURN(napi_set_named_property(env, element, "type", type));
|
|
1628
|
-
|
|
1629
|
-
napi_value startSequence;
|
|
1630
|
-
NAPI_STATUS_RETURN(napi_create_int64(env, files[n]->StartSequence(), &startSequence))
|
|
1631
|
-
NAPI_STATUS_RETURN(napi_set_named_property(env, element, "startSequence", startSequence));
|
|
1632
|
-
|
|
1633
|
-
napi_value sizeFileBytes;
|
|
1634
|
-
NAPI_STATUS_RETURN(napi_create_int64(env, files[n]->SizeFileBytes(), &sizeFileBytes))
|
|
1635
|
-
NAPI_STATUS_RETURN(napi_set_named_property(env, element, "sizeFileBytes", sizeFileBytes));
|
|
1636
|
-
|
|
1637
|
-
NAPI_STATUS_RETURN(napi_set_element(env, argv[1], n, element));
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
return napi_ok;
|
|
1641
|
-
});
|
|
1642
|
-
|
|
1643
|
-
return 0;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
1562
|
NAPI_METHOD(db_flush_wal) {
|
|
1647
1563
|
NAPI_ARGV(3);
|
|
1648
1564
|
|
|
@@ -1672,7 +1588,6 @@ NAPI_INIT() {
|
|
|
1672
1588
|
NAPI_EXPORT_FUNCTION(db_clear);
|
|
1673
1589
|
NAPI_EXPORT_FUNCTION(db_get_property);
|
|
1674
1590
|
NAPI_EXPORT_FUNCTION(db_get_latest_sequence);
|
|
1675
|
-
NAPI_EXPORT_FUNCTION(db_get_sorted_wal_files);
|
|
1676
1591
|
NAPI_EXPORT_FUNCTION(db_flush_wal);
|
|
1677
1592
|
NAPI_EXPORT_FUNCTION(db_get_merge_operands);
|
|
1678
1593
|
|
package/binding.gyp
CHANGED
package/deps/rocksdb/rocksdb.gyp
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"ROCKSDB_PTHREAD_ADAPTIVE_MUTEX=1",
|
|
88
88
|
"ROCKSDB_RANGESYNC_PRESENT=1",
|
|
89
89
|
"ROCKSDB_SCHED_GETCPU_PRESENT=1",
|
|
90
|
-
"ROCKSDB_IOURING_PRESENT=1",
|
|
90
|
+
# "ROCKSDB_IOURING_PRESENT=1",
|
|
91
91
|
"USE_FOLLY=1",
|
|
92
92
|
"FOLLY_NO_CONFIG=1"
|
|
93
93
|
"HAVE_SSE42=1",
|
|
@@ -115,9 +115,6 @@
|
|
|
115
115
|
"/usr/lib/include",
|
|
116
116
|
# "/usr/local/Cellar/jemalloc/5.3.0/include"
|
|
117
117
|
],
|
|
118
|
-
"dependencies": [
|
|
119
|
-
"../liburing/liburing.gyp:liburing"
|
|
120
|
-
],
|
|
121
118
|
"cflags": [
|
|
122
119
|
"-msse4.2",
|
|
123
120
|
"-mpclmul",
|
|
@@ -138,11 +135,11 @@
|
|
|
138
135
|
"defines": ["OS_MACOSX=1"],
|
|
139
136
|
"direct_dependent_settings": {
|
|
140
137
|
"libraries": [
|
|
141
|
-
"/opt/homebrew/Cellar/zstd/1.5.
|
|
138
|
+
"/opt/homebrew/Cellar/zstd/1.5.5/lib/libzstd.a"
|
|
142
139
|
],
|
|
143
140
|
},
|
|
144
141
|
"include_dirs": [
|
|
145
|
-
"/opt/homebrew/Cellar/zstd/1.5.
|
|
142
|
+
"/opt/homebrew/Cellar/zstd/1.5.5/include"
|
|
146
143
|
],
|
|
147
144
|
"xcode_settings": {
|
|
148
145
|
"OTHER_CPLUSPLUSFLAGS": [
|
|
@@ -392,7 +389,6 @@
|
|
|
392
389
|
"rocksdb/util/compression_context_cache.cc",
|
|
393
390
|
"rocksdb/util/concurrent_task_limiter_impl.cc",
|
|
394
391
|
"rocksdb/util/crc32c.cc",
|
|
395
|
-
"rocksdb/util/crc32c_arm64.cc",
|
|
396
392
|
"rocksdb/util/data_structure.cc",
|
|
397
393
|
"rocksdb/util/dynamic_bloom.cc",
|
|
398
394
|
"rocksdb/util/hash.cc",
|
package/index.js
CHANGED
|
@@ -299,12 +299,6 @@ class RocksLevel extends AbstractLevel {
|
|
|
299
299
|
binding.db_flush_wal(this[kContext], options ?? {}, (err, val) => err ? reject(err) : resolve(val))
|
|
300
300
|
})
|
|
301
301
|
}
|
|
302
|
-
|
|
303
|
-
async getSortedWalFiles () {
|
|
304
|
-
return new Promise((resolve, reject) => {
|
|
305
|
-
binding.db_get_sorted_wal_files(this[kContext], (err, val) => err ? reject(err) : resolve(val))
|
|
306
|
-
})
|
|
307
|
-
}
|
|
308
302
|
}
|
|
309
303
|
|
|
310
304
|
exports.RocksLevel = RocksLevel
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"variables": { "openssl_fips": "0" },
|
|
3
|
-
"targets":
|
|
4
|
-
[
|
|
5
|
-
{
|
|
6
|
-
"target_name": "liburing",
|
|
7
|
-
"type": "static_library",
|
|
8
|
-
"include_dirs": ["linux", "liburing/src/include"],
|
|
9
|
-
"direct_dependent_settings":
|
|
10
|
-
{ "include_dirs": ["linux", "liburing/src/include"] },
|
|
11
|
-
"sources":
|
|
12
|
-
[
|
|
13
|
-
"liburing/src/queue.c",
|
|
14
|
-
"liburing/src/register.c",
|
|
15
|
-
"liburing/src/setup.c",
|
|
16
|
-
"liburing/src/syscall.c",
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
}
|