@nxtedition/rocksdb 7.0.8 → 7.0.9
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 +13 -1
- package/iterator.js +4 -0
- package/package.json +1 -1
package/binding.cc
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include <rocksdb/slice_transform.h>
|
|
15
15
|
#include <rocksdb/table.h>
|
|
16
16
|
#include <rocksdb/write_batch.h>
|
|
17
|
+
#include <rocksdb/filter_policy.h>
|
|
17
18
|
|
|
18
19
|
#include <array>
|
|
19
20
|
#include <memory>
|
|
@@ -772,6 +773,13 @@ rocksdb::Status InitOptions(napi_env env, T& columnOptions, const U& options) {
|
|
|
772
773
|
tableOptions.filter_policy.reset(rocksdb::NewRibbonFilterPolicy(10));
|
|
773
774
|
}
|
|
774
775
|
|
|
776
|
+
const auto filterPolicyOpt = StringProperty(env, options, "filterPolicy");
|
|
777
|
+
if (filterPolicyOpt) {
|
|
778
|
+
rocksdb::ConfigOptions configOptions;
|
|
779
|
+
ROCKS_STATUS_RETURN(
|
|
780
|
+
rocksdb::FilterPolicy::CreateFromString(configOptions, *filterPolicyOpt, &tableOptions.filter_policy));
|
|
781
|
+
}
|
|
782
|
+
|
|
775
783
|
tableOptions.block_size = Uint32Property(env, options, "blockSize").value_or(4096);
|
|
776
784
|
tableOptions.block_restart_interval = Uint32Property(env, options, "blockRestartInterval").value_or(16);
|
|
777
785
|
tableOptions.format_version = 5;
|
|
@@ -1155,7 +1163,11 @@ struct GetManyWorker final : public Worker {
|
|
|
1155
1163
|
database_->IncrementPriorityWork(env);
|
|
1156
1164
|
}
|
|
1157
1165
|
|
|
1158
|
-
~GetManyWorker() {
|
|
1166
|
+
~GetManyWorker() {
|
|
1167
|
+
if (snapshot_) {
|
|
1168
|
+
database_->db_->ReleaseSnapshot(snapshot_);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1159
1171
|
|
|
1160
1172
|
rocksdb::Status Execute(Database& database) override {
|
|
1161
1173
|
rocksdb::ReadOptions readOptions;
|
package/iterator.js
CHANGED
|
@@ -29,6 +29,10 @@ class Iterator extends AbstractIterator {
|
|
|
29
29
|
this[kPosition] = 0
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
get sequence () {
|
|
33
|
+
return binding.iterator_get_sequence(this[kContext])
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
_seek (target) {
|
|
33
37
|
if (target.length === 0) {
|
|
34
38
|
throw new Error('cannot seek() to an empty target')
|