@nxtedition/rocksdb 7.0.10 → 7.0.11

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
@@ -1395,6 +1395,21 @@ NAPI_METHOD(db_get_property) {
1395
1395
  return result;
1396
1396
  }
1397
1397
 
1398
+
1399
+ NAPI_METHOD(db_get_latest_sequence) {
1400
+ NAPI_ARGV(1);
1401
+
1402
+ Database* database;
1403
+ NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(&database)));
1404
+
1405
+ const auto seq = database->db_->GetLatestSequenceNumber();
1406
+
1407
+ napi_value result;
1408
+ NAPI_STATUS_THROWS(napi_create_bigint_int64(env, seq, &result));
1409
+
1410
+ return result;
1411
+ }
1412
+
1398
1413
  NAPI_METHOD(iterator_init) {
1399
1414
  NAPI_ARGV(2);
1400
1415
 
@@ -1716,6 +1731,7 @@ NAPI_INIT() {
1716
1731
  NAPI_EXPORT_FUNCTION(db_del);
1717
1732
  NAPI_EXPORT_FUNCTION(db_clear);
1718
1733
  NAPI_EXPORT_FUNCTION(db_get_property);
1734
+ NAPI_EXPORT_FUNCTION(db_get_latest_sequence);
1719
1735
 
1720
1736
  NAPI_EXPORT_FUNCTION(iterator_init);
1721
1737
  NAPI_EXPORT_FUNCTION(iterator_seek);
package/index.js CHANGED
@@ -43,6 +43,10 @@ class RocksLevel extends AbstractLevel {
43
43
  this[kColumns] = {}
44
44
  }
45
45
 
46
+ get sequence () {
47
+ return binding.get_latest_sequence(this[kContext])
48
+ }
49
+
46
50
  get location () {
47
51
  return this[kLocation]
48
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "7.0.10",
3
+ "version": "7.0.11",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",