@nxtedition/rocksdb 7.0.36 → 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 CHANGED
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "7.0.36",
3
+ "version": "7.0.37",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",