From c9d54b6db1eabc1f2ffc685fcae39942ab053f41 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 29 Sep 2017 15:53:09 -0500 Subject: [PATCH] os/ObjectMap: tie ObjectMap::ObjectMapIterator to superclass These iterfaces are similar but ultimately unrelated! Unfortunately we are stuck with a joined class hiearchy because of DBObjectMap. Someday it would be nice to break this link. Signed-off-by: Sage Weil --- src/kv/KeyValueDB.h | 10 +++++++++- src/os/ObjectMap.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kv/KeyValueDB.h b/src/kv/KeyValueDB.h index 818884a1a97..d5bf99c6b94 100644 --- a/src/kv/KeyValueDB.h +++ b/src/kv/KeyValueDB.h @@ -180,7 +180,10 @@ public: return get(prefix, string(key, keylen), value); } - class GenericIteratorImpl { + // This superclass is used both by kv iterators *and* by the ObjectMap + // omap iterator. The class hiearchies are unfortunatley tied together + // by the legacy DBOjectMap implementation :(. + class SimplestIteratorImpl { public: virtual int seek_to_first() = 0; virtual int upper_bound(const std::string &after) = 0; @@ -190,6 +193,11 @@ public: virtual std::string key() = 0; virtual bufferlist value() = 0; virtual int status() = 0; + virtual ~SimplestIteratorImpl() {} + }; + + class GenericIteratorImpl : public SimplestIteratorImpl { + public: virtual ~GenericIteratorImpl() {} }; diff --git a/src/os/ObjectMap.h b/src/os/ObjectMap.h index 32b423c2861..4db3f17dc4b 100644 --- a/src/os/ObjectMap.h +++ b/src/os/ObjectMap.h @@ -156,7 +156,7 @@ public: virtual void compact() {} - typedef KeyValueDB::GenericIteratorImpl ObjectMapIteratorImpl; + typedef KeyValueDB::SimplestIteratorImpl ObjectMapIteratorImpl; typedef ceph::shared_ptr ObjectMapIterator; virtual ObjectMapIterator get_iterator(const ghobject_t &oid) { return ObjectMapIterator(); -- 2.39.5