@nxtedition/rocksdb 10.0.6 → 10.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
CHANGED
|
@@ -323,7 +323,7 @@ struct BaseIterator : public Closable {
|
|
|
323
323
|
|
|
324
324
|
virtual ~BaseIterator() { assert(!iterator_); }
|
|
325
325
|
|
|
326
|
-
bool DidSeek() const { return iterator_ != nullptr; }
|
|
326
|
+
bool DidSeek() const { return iterator_ != nullptr && !target_; }
|
|
327
327
|
|
|
328
328
|
void SeekToRange() {
|
|
329
329
|
if (!iterator_) {
|
|
@@ -338,23 +338,19 @@ struct BaseIterator : public Closable {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
void Seek(const rocksdb::Slice& target) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
} else {
|
|
355
|
-
iterator_->Seek(target);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
341
|
+
if ((upper_bound_ && target.compare(*upper_bound_) >= 0) || (lower_bound_ && target.compare(*lower_bound_) < 0)) {
|
|
342
|
+
// TODO (fix): Why is this required? Seek should handle it?
|
|
343
|
+
// https://github.com/facebook/rocksdb/issues/9904
|
|
344
|
+
iterator_->SeekToLast();
|
|
345
|
+
if (iterator_->Valid()) {
|
|
346
|
+
iterator_->Next();
|
|
347
|
+
}
|
|
348
|
+
} else if (reverse_) {
|
|
349
|
+
iterator_->SeekForPrev(target);
|
|
350
|
+
} else {
|
|
351
|
+
iterator_->Seek(target);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
358
354
|
|
|
359
355
|
rocksdb::Status Close() override {
|
|
360
356
|
snapshot_.reset();
|
|
@@ -422,6 +418,7 @@ struct BaseIterator : public Closable {
|
|
|
422
418
|
std::optional<rocksdb::PinnableSlice> lower_bound_;
|
|
423
419
|
std::optional<rocksdb::PinnableSlice> upper_bound_;
|
|
424
420
|
std::unique_ptr<rocksdb::Iterator> iterator_;
|
|
421
|
+
std::optional<std::string> target_;
|
|
425
422
|
const bool reverse_;
|
|
426
423
|
const int limit_;
|
|
427
424
|
const bool fillCache_;
|
|
@@ -1275,7 +1272,7 @@ NAPI_METHOD(iterator_seek) {
|
|
|
1275
1272
|
NAPI_STATUS_THROWS(GetValue(env, argv[1], target));
|
|
1276
1273
|
|
|
1277
1274
|
iterator->first_ = true;
|
|
1278
|
-
iterator->Seek(target);
|
|
1275
|
+
iterator->Seek(target);
|
|
1279
1276
|
|
|
1280
1277
|
return 0;
|
|
1281
1278
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|