diff options
author | Yingxin Cheng <yingxin.cheng@intel.com> | 2020-02-25 09:17:50 +0100 |
---|---|---|
committer | Yingxin Cheng <yingxin.cheng@intel.com> | 2020-02-25 09:17:50 +0100 |
commit | f33fa244e137f977ba61e52bed6768e614fe5ca1 (patch) | |
tree | 170ef3c3fb49ced35f448f14ddf11f61a663d302 /src | |
parent | crimson/osd: use with_blocking_future in CompoundPeeringRequest (diff) | |
download | ceph-f33fa244e137f977ba61e52bed6768e614fe5ca1.tar.xz ceph-f33fa244e137f977ba61e52bed6768e614fe5ca1.zip |
crimson/osd: hide add_blocker() and clear_blocker() in Operation
Cleanup. Hide add_blocker() and clear_blocker() as private members
because no one is using them anymore. They are not exception-safe. Also
take the chance to reorder Operation class members.
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/crimson/osd/osd_operation.h | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/crimson/osd/osd_operation.h b/src/crimson/osd/osd_operation.h index 7e8a9c2fb54..fe06023a441 100644 --- a/src/crimson/osd/osd_operation.h +++ b/src/crimson/osd/osd_operation.h @@ -115,18 +115,7 @@ public: */ class Operation : public boost::intrusive_ref_counter< Operation, boost::thread_unsafe_counter> { - friend class OperationRegistry; - registry_hook_t registry_hook; - - std::vector<Blocker*> blockers; - uint64_t id = 0; - void set_id(uint64_t in_id) { - id = in_id; - } -protected: - virtual void dump_detail(ceph::Formatter *f) const = 0; - -public: + public: uint64_t get_id() const { return id; } @@ -135,17 +124,6 @@ public: virtual const char *get_type_name() const = 0; virtual void print(std::ostream &) const = 0; - void add_blocker(Blocker *b) { - blockers.push_back(b); - } - - void clear_blocker(Blocker *b) { - auto iter = std::find(blockers.begin(), blockers.end(), b); - if (iter != blockers.end()) { - blockers.erase(iter); - } - } - template <typename... T> seastar::future<T...> with_blocking_future(blocking_future<T...> &&f) { if (f.fut.available()) { @@ -162,6 +140,31 @@ public: void dump(ceph::Formatter *f); void dump_brief(ceph::Formatter *f); virtual ~Operation() = default; + + protected: + virtual void dump_detail(ceph::Formatter *f) const = 0; + + private: + registry_hook_t registry_hook; + + std::vector<Blocker*> blockers; + uint64_t id = 0; + void set_id(uint64_t in_id) { + id = in_id; + } + + void add_blocker(Blocker *b) { + blockers.push_back(b); + } + + void clear_blocker(Blocker *b) { + auto iter = std::find(blockers.begin(), blockers.end(), b); + if (iter != blockers.end()) { + blockers.erase(iter); + } + } + + friend class OperationRegistry; }; using OperationRef = boost::intrusive_ptr<Operation>; |