@nxtedition/rocksdb 7.0.36 → 7.0.39

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
@@ -1528,7 +1528,7 @@ NAPI_METHOD(db_get_latest_sequence) {
1528
1528
  const auto seq = database->db_->GetLatestSequenceNumber();
1529
1529
 
1530
1530
  napi_value result;
1531
- NAPI_STATUS_THROWS(napi_create_bigint_int64(env, seq, &result));
1531
+ NAPI_STATUS_THROWS(napi_create_int64(env, seq, &result));
1532
1532
 
1533
1533
  return result;
1534
1534
  }
@@ -1609,7 +1609,7 @@ NAPI_METHOD(iterator_get_sequence) {
1609
1609
  const auto seq = iterator->snapshot_->GetSequenceNumber();
1610
1610
 
1611
1611
  napi_value result;
1612
- NAPI_STATUS_THROWS(napi_create_bigint_int64(env, seq, &result));
1612
+ NAPI_STATUS_THROWS(napi_create_int64(env, seq, &result));
1613
1613
 
1614
1614
  return result;
1615
1615
  }
@@ -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_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/index.js CHANGED
@@ -60,7 +60,7 @@ class RocksLevel extends AbstractLevel {
60
60
  }
61
61
 
62
62
  get sequence () {
63
- return Number(binding.db_get_latest_sequence(this[kContext]))
63
+ return binding.db_get_latest_sequence(this[kContext])
64
64
  }
65
65
 
66
66
  get location () {
@@ -216,7 +216,7 @@ class RocksLevel extends AbstractLevel {
216
216
  } else {
217
217
  resolve({
218
218
  rows,
219
- sequence: Number(binding.iterator_get_sequence(context)),
219
+ sequence: binding.iterator_get_sequence(context),
220
220
  finished
221
221
  })
222
222
  }
package/iterator.js CHANGED
@@ -30,7 +30,7 @@ class Iterator extends AbstractIterator {
30
30
  }
31
31
 
32
32
  get sequence () {
33
- return Number(binding.iterator_get_sequence(this[kContext]))
33
+ return binding.iterator_get_sequence(this[kContext])
34
34
  }
35
35
 
36
36
  _seek (target) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "7.0.36",
3
+ "version": "7.0.39",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",