@nxtedition/rocksdb 7.0.34 → 7.0.37
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 +15 -3
- package/chained-batch.js +4 -0
- package/index.js +7 -6
- 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
|
};
|
|
@@ -1845,6 +1845,18 @@ NAPI_METHOD(batch_clear) {
|
|
|
1845
1845
|
return 0;
|
|
1846
1846
|
}
|
|
1847
1847
|
|
|
1848
|
+
NAPI_METHOD(batch_count) {
|
|
1849
|
+
NAPI_ARGV(2);
|
|
1850
|
+
|
|
1851
|
+
rocksdb::WriteBatch* batch;
|
|
1852
|
+
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[1], reinterpret_cast<void**>(&batch)));
|
|
1853
|
+
|
|
1854
|
+
napi_value result;
|
|
1855
|
+
NAPI_STATUS_THROWS(napi_create_bigint_int64(env, batch->Count(), &result));
|
|
1856
|
+
|
|
1857
|
+
return result;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1848
1860
|
NAPI_METHOD(batch_write) {
|
|
1849
1861
|
NAPI_ARGV(3);
|
|
1850
1862
|
|
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/index.js
CHANGED
|
@@ -241,7 +241,13 @@ class RocksLevel extends AbstractLevel {
|
|
|
241
241
|
since: options?.since ?? 0,
|
|
242
242
|
keys: options?.keys ?? true,
|
|
243
243
|
values: options?.values ?? true,
|
|
244
|
-
data: options?.data ?? true
|
|
244
|
+
data: options?.data ?? true,
|
|
245
|
+
column: options?.column ?? null
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// HACK: We don't properly check for nully column in binding.
|
|
249
|
+
if (!options.column) {
|
|
250
|
+
delete options.column
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
if (typeof options.since !== 'number') {
|
|
@@ -264,11 +270,6 @@ class RocksLevel extends AbstractLevel {
|
|
|
264
270
|
throw new TypeError("'column' must be nully or a object")
|
|
265
271
|
}
|
|
266
272
|
|
|
267
|
-
// HACK: We don't properly check for nully column in binding.
|
|
268
|
-
if (!options.column) {
|
|
269
|
-
delete options.column
|
|
270
|
-
}
|
|
271
|
-
|
|
272
273
|
class Updates {
|
|
273
274
|
constructor (db, options) {
|
|
274
275
|
this.context = binding.updates_init(db[kContext], options)
|
package/package.json
CHANGED
|
Binary file
|