summaryrefslogtreecommitdiffstats
path: root/src/kv
diff options
context:
space:
mode:
authorKefu Chai <tchaikov@gmail.com>2018-12-17 17:58:28 +0100
committerGitHub <noreply@github.com>2018-12-17 17:58:28 +0100
commit7a7f7757ed2db2c6b019942fceeb63527094ca51 (patch)
tree4e675669ff35f8bd90b227984146779569d2ccd3 /src/kv
parentMerge pull request #25489 from rhcs-dashboard/36740-add-info-to-pools-table (diff)
parentcommon/KeyValueDB: Get rid of validate parameter. (diff)
downloadceph-7a7f7757ed2db2c6b019942fceeb63527094ca51.tar.xz
ceph-7a7f7757ed2db2c6b019942fceeb63527094ca51.zip
Merge pull request #25377 from aclamk/wip-kv-remove-validate
common/KeyValueDB: Get rid of validate parameter. Reviewed-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/kv')
-rw-r--r--src/kv/KeyValueDB.h27
-rw-r--r--src/kv/RocksDBStore.cc4
2 files changed, 8 insertions, 23 deletions
diff --git a/src/kv/KeyValueDB.h b/src/kv/KeyValueDB.h
index bbea6119fed..4cfc3891fb4 100644
--- a/src/kv/KeyValueDB.h
+++ b/src/kv/KeyValueDB.h
@@ -208,7 +208,7 @@ public:
virtual int upper_bound(const std::string &after) = 0;
virtual int lower_bound(const std::string &to) = 0;
virtual bool valid() = 0;
- virtual int next(bool validate=true) = 0;
+ virtual int next() = 0;
virtual std::string key() = 0;
virtual bufferlist value() = 0;
virtual int status() = 0;
@@ -219,7 +219,7 @@ public:
public:
virtual ~IteratorImpl() {}
virtual int seek_to_last() = 0;
- virtual int prev(bool validate=true) = 0;
+ virtual int prev() = 0;
virtual std::pair<std::string, std::string> raw_key() = 0;
virtual bufferptr value_as_ptr() {
bufferlist bl = value();
@@ -299,26 +299,11 @@ private:
return false;
return generic_iter->raw_key_is_prefixed(prefix);
}
- // Note that next() and prev() shouldn't validate iters,
- // it's responsibility of caller to ensure they're valid.
- int next(bool validate=true) override {
- if (validate) {
- if (valid())
- return generic_iter->next();
- return status();
- } else {
- return generic_iter->next();
- }
+ int next() override {
+ return generic_iter->next();
}
-
- int prev(bool validate=true) override {
- if (validate) {
- if (valid())
- return generic_iter->prev();
- return status();
- } else {
- return generic_iter->prev();
- }
+ int prev() override {
+ return generic_iter->prev();
}
std::string key() override {
return generic_iter->key();
diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
index 2f47cb5358f..8acea01d6fa 100644
--- a/src/kv/RocksDBStore.cc
+++ b/src/kv/RocksDBStore.cc
@@ -1504,13 +1504,13 @@ public:
dbiter->Seek(slice_bound);
return dbiter->status().ok() ? 0 : -1;
}
- int next(bool validate=true) override {
+ int next() override {
if (valid()) {
dbiter->Next();
}
return dbiter->status().ok() ? 0 : -1;
}
- int prev(bool validate=true) override {
+ int prev() override {
if (valid()) {
dbiter->Prev();
}