@nxtedition/rocksdb 7.0.35 → 7.0.38
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 +16 -3
- package/chained-batch.js +4 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
package/binding.cc
CHANGED
|
@@ -976,7 +976,7 @@ struct UpdatesNextWorker final : public rocksdb::WriteBatch::Handler, public Wor
|
|
|
976
976
|
|
|
977
977
|
NAPI_STATUS_RETURN(napi_get_null(env, &argv[0]));
|
|
978
978
|
|
|
979
|
-
if (
|
|
979
|
+
if (count_ == -1) {
|
|
980
980
|
return CallFunction(env, callback, 1, argv);
|
|
981
981
|
}
|
|
982
982
|
|
|
@@ -1068,7 +1068,7 @@ struct UpdatesNextWorker final : public rocksdb::WriteBatch::Handler, public Wor
|
|
|
1068
1068
|
return rocksdb::Status::OK();
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
|
-
cache_.emplace_back("
|
|
1071
|
+
cache_.emplace_back("merge");
|
|
1072
1072
|
|
|
1073
1073
|
if (updates_->keys_) {
|
|
1074
1074
|
cache_.emplace_back(key.ToStringView());
|
|
@@ -1103,7 +1103,7 @@ struct UpdatesNextWorker final : public rocksdb::WriteBatch::Handler, public Wor
|
|
|
1103
1103
|
bool Continue() override { return true; }
|
|
1104
1104
|
|
|
1105
1105
|
private:
|
|
1106
|
-
|
|
1106
|
+
int64_t count_ = -1;
|
|
1107
1107
|
std::vector<std::optional<std::string>> cache_;
|
|
1108
1108
|
Updates* updates_;
|
|
1109
1109
|
};
|
|
@@ -1900,6 +1900,18 @@ NAPI_METHOD(batch_merge) {
|
|
|
1900
1900
|
return 0;
|
|
1901
1901
|
}
|
|
1902
1902
|
|
|
1903
|
+
NAPI_METHOD(batch_count) {
|
|
1904
|
+
NAPI_ARGV(2);
|
|
1905
|
+
|
|
1906
|
+
rocksdb::WriteBatch* batch;
|
|
1907
|
+
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[1], reinterpret_cast<void**>(&batch)));
|
|
1908
|
+
|
|
1909
|
+
napi_value result;
|
|
1910
|
+
NAPI_STATUS_THROWS(napi_create_bigint_int64(env, batch->Count(), &result));
|
|
1911
|
+
|
|
1912
|
+
return result;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1903
1915
|
NAPI_METHOD(db_flush_wal) {
|
|
1904
1916
|
NAPI_ARGV(2);
|
|
1905
1917
|
|
|
@@ -2009,4 +2021,5 @@ NAPI_INIT() {
|
|
|
2009
2021
|
NAPI_EXPORT_FUNCTION(batch_write);
|
|
2010
2022
|
NAPI_EXPORT_FUNCTION(batch_put_log_data);
|
|
2011
2023
|
NAPI_EXPORT_FUNCTION(batch_merge);
|
|
2024
|
+
NAPI_EXPORT_FUNCTION(batch_count);
|
|
2012
2025
|
}
|
package/chained-batch.js
CHANGED
|
@@ -48,6 +48,10 @@ class ChainedBatch extends AbstractChainedBatch {
|
|
|
48
48
|
// TODO (fix): Check if open...
|
|
49
49
|
binding.batch_merge(this[kDbContext], this[kBatchContext], key, value, options)
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
get count () {
|
|
53
|
+
return binding.batch_count(this[kDbContext], this[kBatchContext])
|
|
54
|
+
}
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
exports.ChainedBatch = ChainedBatch
|
package/package.json
CHANGED
|
Binary file
|