virtual void upper_bound(const ghobject_t &oid) = 0;
virtual void next() = 0;
+ virtual int cmp(const ghobject_t &oid) const = 0;
+
+ bool is_ge(const ghobject_t &oid) const {
+ return cmp(oid) >= 0;
+ }
+
+ bool is_lt(const ghobject_t &oid) const {
+ return cmp(oid) < 0;
+ }
+
protected:
KeyValueDB::Iterator m_it;
};
get_oid();
}
+ int cmp(const ghobject_t &oid) const override {
+ ceph_assert(valid());
+
+ string key;
+ get_object_key(m_cct, oid, &key);
+
+ return m_it->key().compare(key);
+ }
+
private:
CephContext *m_cct;
ghobject_t m_oid;
}
}
+ int cmp(const ghobject_t &oid) const override {
+ ceph_assert(valid());
+
+ if (this->oid() < oid) {
+ return -1;
+ }
+ if (this->oid() > oid) {
+ return 1;
+ }
+ return 0;
+ }
+
private:
std::map<ghobject_t, std::string> m_chunk;
std::map<ghobject_t, std::string>::iterator m_chunk_iter;
}
dout(20) << __func__ << " pend " << pend << dendl;
while (true) {
- if (!it->valid() || it->oid() >= pend) {
+ if (!it->valid() || it->is_ge(pend)) {
if (!it->valid())
dout(20) << __func__ << " iterator not valid (end of db?)" << dendl;
else
dout(20) << __func__ << " oid " << it->oid() << " >= " << pend << dendl;
if (temp) {
if (end.hobj.is_temp()) {
- if (it->valid() && it->oid() < coll_range_temp_end) {
+ if (it->valid() && it->is_lt(coll_range_temp_end)) {
*pnext = it->oid();
set_next = true;
}
dout(30) << __func__ << " pend " << pend << dendl;
continue;
}
- if (it->valid() && it->oid() < coll_range_end) {
+ if (it->valid() && it->is_lt(coll_range_end)) {
*pnext = it->oid();
set_next = true;
}