@nxtedition/rocksdb 7.0.0-alpha.8 → 7.0.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
CHANGED
|
@@ -526,7 +526,7 @@ struct Iterator final : public BaseIterator {
|
|
|
526
526
|
const bool fillCache,
|
|
527
527
|
const bool keyAsBuffer,
|
|
528
528
|
const bool valueAsBuffer,
|
|
529
|
-
const
|
|
529
|
+
const int32_t highWaterMarkBytes,
|
|
530
530
|
std::shared_ptr<const rocksdb::Snapshot> snapshot)
|
|
531
531
|
: BaseIterator(database, column, reverse, lt, lte, gt, gte, limit, fillCache, snapshot),
|
|
532
532
|
keys_(keys),
|
|
@@ -551,7 +551,7 @@ struct Iterator final : public BaseIterator {
|
|
|
551
551
|
const bool values_;
|
|
552
552
|
const bool keyAsBuffer_;
|
|
553
553
|
const bool valueAsBuffer_;
|
|
554
|
-
const
|
|
554
|
+
const int32_t highWaterMarkBytes_;
|
|
555
555
|
bool first_ = true;
|
|
556
556
|
|
|
557
557
|
private:
|
|
@@ -691,7 +691,8 @@ struct OpenWorker final : public Worker {
|
|
|
691
691
|
std::vector<rocksdb::ColumnFamilyDescriptor> column_families_;
|
|
692
692
|
};
|
|
693
693
|
|
|
694
|
-
|
|
694
|
+
template <typename T>
|
|
695
|
+
napi_status InitOptions(napi_env env, T& columnOptions, auto options) {
|
|
695
696
|
const auto memtable_memory_budget = Uint32Property(env, options, "memtableMemoryBudget").value_or(256 * 1024 * 1024);
|
|
696
697
|
|
|
697
698
|
const auto compaction = StringProperty(env, options, "compaction").value_or("level");
|
|
@@ -791,9 +792,9 @@ NAPI_METHOD(db_open) {
|
|
|
791
792
|
|
|
792
793
|
dbOptions.create_if_missing = BooleanProperty(env, options, "createIfMissing").value_or(true);
|
|
793
794
|
dbOptions.error_if_exists = BooleanProperty(env, options, "errorIfExists").value_or(false);
|
|
794
|
-
dbOptions.avoid_unnecessary_blocking_io =
|
|
795
|
-
dbOptions.use_adaptive_mutex =
|
|
796
|
-
dbOptions.enable_pipelined_write =
|
|
795
|
+
dbOptions.avoid_unnecessary_blocking_io = true;
|
|
796
|
+
dbOptions.use_adaptive_mutex = true;
|
|
797
|
+
dbOptions.enable_pipelined_write = false;
|
|
797
798
|
dbOptions.max_background_jobs =
|
|
798
799
|
Uint32Property(env, options, "maxBackgroundJobs").value_or(std::thread::hardware_concurrency() / 4);
|
|
799
800
|
dbOptions.WAL_ttl_seconds = Uint32Property(env, options, "walTTL").value_or(0) / 1e3;
|
|
@@ -1375,7 +1376,7 @@ NAPI_METHOD(iterator_init) {
|
|
|
1375
1376
|
const bool keyAsBuffer = EncodingIsBuffer(env, options, "keyEncoding");
|
|
1376
1377
|
const bool valueAsBuffer = EncodingIsBuffer(env, options, "valueEncoding");
|
|
1377
1378
|
const auto limit = Int32Property(env, options, "limit").value_or(-1);
|
|
1378
|
-
const auto highWaterMarkBytes =
|
|
1379
|
+
const auto highWaterMarkBytes = Int32Property(env, options, "highWaterMarkBytes").value_or(16 * 1024);
|
|
1379
1380
|
|
|
1380
1381
|
const auto lt = StringProperty(env, options, "lt");
|
|
1381
1382
|
const auto lte = StringProperty(env, options, "lte");
|
|
@@ -1480,7 +1481,7 @@ struct NextWorker final : public Worker {
|
|
|
1480
1481
|
cache_.push_back(v.ToString());
|
|
1481
1482
|
}
|
|
1482
1483
|
|
|
1483
|
-
if ((iterator_->highWaterMarkBytes_ != -1 && bytesRead > iterator_->highWaterMarkBytes_) || cache_.size() / 2 >= size_) {
|
|
1484
|
+
if ((iterator_->highWaterMarkBytes_ != -1 && bytesRead > static_cast<size_t>(iterator_->highWaterMarkBytes_)) || cache_.size() / 2 >= size_) {
|
|
1484
1485
|
finished_ = false;
|
|
1485
1486
|
return rocksdb::Status::OK();
|
|
1486
1487
|
}
|
|
@@ -1547,7 +1548,6 @@ NAPI_METHOD(batch_do) {
|
|
|
1547
1548
|
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], (void**)&database));
|
|
1548
1549
|
|
|
1549
1550
|
const auto operations = argv[1];
|
|
1550
|
-
const auto options = argv[2];
|
|
1551
1551
|
|
|
1552
1552
|
rocksdb::WriteBatch batch;
|
|
1553
1553
|
|
package/index.js
CHANGED
|
@@ -128,7 +128,10 @@ class RocksLevel extends AbstractLevel {
|
|
|
128
128
|
})
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
const context = binding.iterator_init(this[kContext], {
|
|
131
|
+
const context = binding.iterator_init(this[kContext], {
|
|
132
|
+
highWaterMarkBytes: 1024 * 1024 * 1024, // TODO (fix): Replace with -1.
|
|
133
|
+
...options
|
|
134
|
+
})
|
|
132
135
|
const resource = {
|
|
133
136
|
callback: null,
|
|
134
137
|
close (callback) {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|