@nxtedition/rocksdb 7.1.29 → 7.1.30
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 +34 -0
- package/index.js +4 -0
- package/package.json +2 -2
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
package/binding.cc
CHANGED
|
@@ -608,6 +608,24 @@ napi_status InitOptions(napi_env env, T& columnOptions, const U& options) {
|
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
+
std::optional<std::string> compactionPriority;
|
|
612
|
+
NAPI_STATUS_RETURN(GetProperty(env, options, "compactionPriority", compactionPriority));
|
|
613
|
+
if (compactionPriority) {
|
|
614
|
+
if (compactionPriority == "byCompensatedSize") {
|
|
615
|
+
columnOptions.compaction_pri = rocksdb::kByCompensatedSize;
|
|
616
|
+
} else if (compactionPriority == "oldestLargestSeqFirst") {
|
|
617
|
+
columnOptions.compaction_pri = rocksdb::kOldestLargestSeqFirst;
|
|
618
|
+
} else if (compactionPriority == "smallestSeqFirst") {
|
|
619
|
+
columnOptions.compaction_pri = rocksdb::kOldestSmallestSeqFirst;
|
|
620
|
+
} else if (compactionPriority == "overlappingRatio") {
|
|
621
|
+
columnOptions.compaction_pri = rocksdb::kMinOverlappingRatio;
|
|
622
|
+
} else if (compactionPriority == "roundRobin") {
|
|
623
|
+
columnOptions.compaction_pri = rocksdb::kRoundRobin;
|
|
624
|
+
} else {
|
|
625
|
+
// Throw?
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
611
629
|
uint32_t cacheSize = 8 << 20;
|
|
612
630
|
NAPI_STATUS_RETURN(GetProperty(env, options, "cacheSize", cacheSize));
|
|
613
631
|
|
|
@@ -661,6 +679,21 @@ napi_status InitOptions(napi_env env, T& columnOptions, const U& options) {
|
|
|
661
679
|
return napi_ok;
|
|
662
680
|
}
|
|
663
681
|
|
|
682
|
+
NAPI_METHOD(db_get_identity) {
|
|
683
|
+
NAPI_ARGV(1);
|
|
684
|
+
|
|
685
|
+
Database* database;
|
|
686
|
+
NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(&database)));
|
|
687
|
+
|
|
688
|
+
std::string identity;
|
|
689
|
+
ROCKS_STATUS_THROWS_NAPI(database->db->GetDbIdentity(identity));
|
|
690
|
+
|
|
691
|
+
napi_value result;
|
|
692
|
+
NAPI_STATUS_THROWS(Convert(env, &identity, Encoding::String, result));
|
|
693
|
+
|
|
694
|
+
return result;
|
|
695
|
+
}
|
|
696
|
+
|
|
664
697
|
NAPI_METHOD(db_open) {
|
|
665
698
|
NAPI_ARGV(4);
|
|
666
699
|
|
|
@@ -1683,6 +1716,7 @@ NAPI_METHOD(db_flush_wal) {
|
|
|
1683
1716
|
NAPI_INIT() {
|
|
1684
1717
|
NAPI_EXPORT_FUNCTION(db_init);
|
|
1685
1718
|
NAPI_EXPORT_FUNCTION(db_open);
|
|
1719
|
+
NAPI_EXPORT_FUNCTION(db_get_identity);
|
|
1686
1720
|
NAPI_EXPORT_FUNCTION(db_close);
|
|
1687
1721
|
NAPI_EXPORT_FUNCTION(db_get_many);
|
|
1688
1722
|
NAPI_EXPORT_FUNCTION(db_clear);
|
package/index.js
CHANGED
|
@@ -253,6 +253,10 @@ class RocksLevel extends AbstractLevel {
|
|
|
253
253
|
return new Iterator(this, this[kContext], options ?? EMPTY)
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
get identity () {
|
|
257
|
+
return binding.db_get_identity(this[kContext])
|
|
258
|
+
}
|
|
259
|
+
|
|
256
260
|
getProperty (property) {
|
|
257
261
|
if (typeof property !== 'string') {
|
|
258
262
|
throw new TypeError("The first argument 'property' must be a string")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/rocksdb",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.30",
|
|
4
4
|
"description": "A low-level Node.js RocksDB binding",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"rimraf": "^3.0.0",
|
|
37
37
|
"standard": "^17.0.0",
|
|
38
38
|
"tape": "^5.6.1",
|
|
39
|
-
"tempy": "^
|
|
39
|
+
"tempy": "^1.0.1"
|
|
40
40
|
},
|
|
41
41
|
"standard": {
|
|
42
42
|
"ignore": [
|
|
Binary file
|