From: liuchang0812 Date: Wed, 22 Feb 2017 11:51:51 +0000 (+0800) Subject: common: add override in header file X-Git-Tag: v12.0.1~130^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=288924338a6e65650f65781c528d10f03fa8459d;p=ceph.git common: add override in header file Signed-off-by: liuchang0812 --- diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index 824be1272d5b..099ceb0020d9 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -153,7 +153,7 @@ int main(int argc, const char **argv, const char *envp[]) { cfuse = cf; client = cl; } - ~RemountTest() {} + ~RemountTest() override {} void *entry() override { #if defined(__linux__) int ver = get_linux_version(); diff --git a/src/client/Client.h b/src/client/Client.h index baa79ab94810..b6253fbab765 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -259,7 +259,7 @@ class Client : public Dispatcher, public md_config_obs_t { public: explicit CommandHook(Client *client); bool call(std::string command, cmdmap_t &cmdmap, std::string format, - bufferlist& out); + bufferlist& out) override; }; CommandHook m_command_hook; @@ -554,13 +554,13 @@ protected: // friends friend class SyntheticClient; - bool ms_dispatch(Message *m); + bool ms_dispatch(Message *m) override; - void ms_handle_connect(Connection *con); - bool ms_handle_reset(Connection *con); - void ms_handle_remote_reset(Connection *con); - bool ms_handle_refused(Connection *con); - bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, bool force_new); + void ms_handle_connect(Connection *con) override; + bool ms_handle_reset(Connection *con) override; + void ms_handle_remote_reset(Connection *con) override; + bool ms_handle_refused(Connection *con) override; + bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, bool force_new) override; int authenticate(); @@ -591,7 +591,7 @@ protected: void clear_filer_flags(int flags); Client(Messenger *m, MonClient *mc); - ~Client(); + ~Client() override; void tear_down_cache(); void update_metadata(std::string const &k, std::string const &v); @@ -751,8 +751,8 @@ private: Client *client; Fh *f; C_Readahead(Client *c, Fh *f); - ~C_Readahead(); - void finish(int r); + ~C_Readahead() override; + void finish(int r) override; }; int _read_sync(Fh *f, uint64_t off, uint64_t len, bufferlist *bl, bool *checkeof); @@ -1219,9 +1219,9 @@ public: void ll_register_callbacks(struct client_callback_args *args); int test_dentry_handling(bool can_invalidate); - virtual const char** get_tracked_conf_keys() const; - virtual void handle_conf_change(const struct md_config_t *conf, - const std::set &changed); + const char** get_tracked_conf_keys() const override; + void handle_conf_change(const struct md_config_t *conf, + const std::set &changed) override; }; #endif diff --git a/src/client/ObjecterWriteback.h b/src/client/ObjecterWriteback.h index d9b0647482d0..97cb228d5b89 100644 --- a/src/client/ObjecterWriteback.h +++ b/src/client/ObjecterWriteback.h @@ -12,29 +12,29 @@ class ObjecterWriteback : public WritebackHandler { : m_objecter(o), m_finisher(fin), m_lock(lock) { } - virtual ~ObjecterWriteback() {} + ~ObjecterWriteback() override {} - virtual void read(const object_t& oid, uint64_t object_no, + void read(const object_t& oid, uint64_t object_no, const object_locator_t& oloc, uint64_t off, uint64_t len, snapid_t snapid, bufferlist *pbl, uint64_t trunc_size, - __u32 trunc_seq, int op_flags, Context *onfinish) { + __u32 trunc_seq, int op_flags, Context *onfinish) override { m_objecter->read_trunc(oid, oloc, off, len, snapid, pbl, 0, trunc_size, trunc_seq, new C_OnFinisher(new C_Lock(m_lock, onfinish), m_finisher)); } - virtual bool may_copy_on_write(const object_t& oid, uint64_t read_off, - uint64_t read_len, snapid_t snapid) { + bool may_copy_on_write(const object_t& oid, uint64_t read_off, + uint64_t read_len, snapid_t snapid) override { return false; } - virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc, + ceph_tid_t write(const object_t& oid, const object_locator_t& oloc, uint64_t off, uint64_t len, const SnapContext& snapc, const bufferlist &bl, ceph::real_time mtime, uint64_t trunc_size, __u32 trunc_seq, ceph_tid_t journal_tid, - Context *oncommit) { + Context *oncommit) override { return m_objecter->write_trunc(oid, oloc, off, len, snapc, bl, mtime, 0, trunc_size, trunc_seq, new C_OnFinisher(new C_Lock(m_lock, @@ -42,13 +42,13 @@ class ObjecterWriteback : public WritebackHandler { m_finisher)); } - virtual bool can_scattered_write() { return true; } + bool can_scattered_write() override { return true; } using WritebackHandler::write; - virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc, + ceph_tid_t write(const object_t& oid, const object_locator_t& oloc, vector >& io_vec, const SnapContext& snapc, ceph::real_time mtime, uint64_t trunc_size, __u32 trunc_seq, - Context *oncommit) { + Context *oncommit) override { ObjectOperation op; for (vector >::iterator p = io_vec.begin(); p != io_vec.end(); diff --git a/src/cls/cephfs/cls_cephfs.cc b/src/cls/cephfs/cls_cephfs.cc index 61c51823704a..6ae1f8d28807 100644 --- a/src/cls/cephfs/cls_cephfs.cc +++ b/src/cls/cephfs/cls_cephfs.cc @@ -145,7 +145,7 @@ public: return 0; } - ~PGLSCephFSFilter() {} + ~PGLSCephFSFilter() override {} bool reject_empty_xattr() override { return false; } bool filter(const hobject_t &obj, bufferlist& xattr_data, bufferlist& outdata) override; diff --git a/src/cls/hello/cls_hello.cc b/src/cls/hello/cls_hello.cc index 48759255b6fa..030c775bfe0f 100644 --- a/src/cls/hello/cls_hello.cc +++ b/src/cls/hello/cls_hello.cc @@ -262,7 +262,7 @@ public: return 0; } - ~PGLSHelloFilter() {} + ~PGLSHelloFilter() override {} bool filter(const hobject_t &obj, bufferlist& xattr_data, bufferlist& outdata) override { diff --git a/src/cls/rgw/cls_rgw_client.cc b/src/cls/rgw/cls_rgw_client.cc index e981abd5624e..c521a038056f 100644 --- a/src/cls/rgw/cls_rgw_client.cc +++ b/src/cls/rgw/cls_rgw_client.cc @@ -24,7 +24,7 @@ private: int *ret_code; public: ClsBucketIndexOpCtx(T* _data, int *_ret_code) : data(_data), ret_code(_ret_code) { assert(data); } - ~ClsBucketIndexOpCtx() {} + ~ClsBucketIndexOpCtx() override {} void handle_completion(int r, bufferlist& outbl) override { if (r >= 0) { try { @@ -520,7 +520,7 @@ class GetDirHeaderCompletion : public ObjectOperationCompletion { RGWGetDirHeader_CB *ret_ctx; public: explicit GetDirHeaderCompletion(RGWGetDirHeader_CB *_ctx) : ret_ctx(_ctx) {} - ~GetDirHeaderCompletion() { + ~GetDirHeaderCompletion() override { ret_ctx->put(); } void handle_completion(int r, bufferlist& outbl) override { diff --git a/src/cls/rgw/cls_rgw_client.h b/src/cls/rgw/cls_rgw_client.h index be7106a6c34f..084e2578052e 100644 --- a/src/cls/rgw/cls_rgw_client.h +++ b/src/cls/rgw/cls_rgw_client.h @@ -122,7 +122,7 @@ public: class RGWGetDirHeader_CB : public RefCountedObject { public: - virtual ~RGWGetDirHeader_CB() {} + ~RGWGetDirHeader_CB() override {} virtual void handle_response(int r, rgw_bucket_dir_header& header) = 0; }; @@ -285,9 +285,9 @@ public: class CLSRGWIssueBucketIndexInit : public CLSRGWConcurrentIO { protected: - int issue_op(int shard_id, const string& oid); - int valid_ret_code() { return -EEXIST; } - void cleanup(); + int issue_op(int shard_id, const string& oid) override; + int valid_ret_code() override { return -EEXIST; } + void cleanup() override; public: CLSRGWIssueBucketIndexInit(librados::IoCtx& ioc, map& _bucket_objs, uint32_t _max_aio) : @@ -297,7 +297,7 @@ public: class CLSRGWIssueSetTagTimeout : public CLSRGWConcurrentIO { uint64_t tag_timeout; protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; public: CLSRGWIssueSetTagTimeout(librados::IoCtx& ioc, map& _bucket_objs, uint32_t _max_aio, uint64_t _tag_timeout) : @@ -368,7 +368,7 @@ class CLSRGWIssueBucketList : public CLSRGWConcurrentIO { bool list_versions; map& result; protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; public: CLSRGWIssueBucketList(librados::IoCtx& io_ctx, const cls_rgw_obj_key& _start_obj, const string& _filter_prefix, uint32_t _num_entries, @@ -385,7 +385,7 @@ class CLSRGWIssueBILogList : public CLSRGWConcurrentIO { BucketIndexShardsManager& marker_mgr; uint32_t max; protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; public: CLSRGWIssueBILogList(librados::IoCtx& io_ctx, BucketIndexShardsManager& _marker_mgr, uint32_t _max, map& oids, @@ -398,12 +398,12 @@ class CLSRGWIssueBILogTrim : public CLSRGWConcurrentIO { BucketIndexShardsManager& start_marker_mgr; BucketIndexShardsManager& end_marker_mgr; protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; // Trim until -ENODATA is returned. - int valid_ret_code() { return -ENODATA; } - bool need_multiple_rounds() { return true; } - void add_object(int shard, const string& oid) { objs_container[shard] = oid; } - void reset_container(map& objs) { + int valid_ret_code() override { return -ENODATA; } + bool need_multiple_rounds() override { return true; } + void add_object(int shard, const string& oid) override { objs_container[shard] = oid; } + void reset_container(map& objs) override { objs_container.swap(objs); iter = objs_container.begin(); objs.clear(); @@ -427,7 +427,7 @@ public: class CLSRGWIssueBucketCheck : public CLSRGWConcurrentIO /* >*/ { map& result; protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; public: CLSRGWIssueBucketCheck(librados::IoCtx& ioc, map& oids, map& bucket_objs_ret, uint32_t _max_aio) : @@ -436,7 +436,7 @@ public: class CLSRGWIssueBucketRebuild : public CLSRGWConcurrentIO { protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; public: CLSRGWIssueBucketRebuild(librados::IoCtx& io_ctx, map& bucket_objs, uint32_t max_aio) : CLSRGWConcurrentIO(io_ctx, bucket_objs, max_aio) {} @@ -445,7 +445,7 @@ public: class CLSRGWIssueGetDirHeader : public CLSRGWConcurrentIO { map& result; protected: - int issue_op(int shard_id, const string& oid); + int issue_op(int shard_id, const string& oid) override; public: CLSRGWIssueGetDirHeader(librados::IoCtx& io_ctx, map& oids, map& dir_headers, uint32_t max_aio) : diff --git a/src/cls/user/cls_user_client.cc b/src/cls/user/cls_user_client.cc index 8bb7d8447b17..2625adda3cde 100644 --- a/src/cls/user/cls_user_client.cc +++ b/src/cls/user/cls_user_client.cc @@ -97,7 +97,7 @@ class ClsUserGetHeaderCtx : public ObjectOperationCompletion { int *pret; public: ClsUserGetHeaderCtx(cls_user_header *_h, RGWGetUserHeader_CB *_ctx, int *_pret) : header(_h), ret_ctx(_ctx), pret(_pret) {} - ~ClsUserGetHeaderCtx() { + ~ClsUserGetHeaderCtx() override { if (ret_ctx) { ret_ctx->put(); } diff --git a/src/cls/user/cls_user_client.h b/src/cls/user/cls_user_client.h index 5a1d9441200a..9465faa7c51b 100644 --- a/src/cls/user/cls_user_client.h +++ b/src/cls/user/cls_user_client.h @@ -11,7 +11,7 @@ class RGWGetUserHeader_CB : public RefCountedObject { public: - virtual ~RGWGetUserHeader_CB() {} + ~RGWGetUserHeader_CB() override {} virtual void handle_response(int r, cls_user_header& header) = 0; }; diff --git a/src/common/Cond.h b/src/common/Cond.h index de625429273f..14022768303a 100644 --- a/src/common/Cond.h +++ b/src/common/Cond.h @@ -139,7 +139,7 @@ public: C_Cond(Cond *c, bool *d, int *r) : cond(c), done(d), rval(r) { *done = false; } - void finish(int r) { + void finish(int r) override { *done = true; *rval = r; cond->Signal(); @@ -162,7 +162,7 @@ public: C_SafeCond(Mutex *l, Cond *c, bool *d, int *r=0) : lock(l), cond(c), done(d), rval(r) { *done = false; } - void finish(int r) { + void finish(int r) override { lock->Lock(); if (rval) *rval = r; @@ -185,10 +185,10 @@ class C_SaferCond : public Context { int rval; ///< return value public: C_SaferCond() : lock("C_SaferCond"), done(false), rval(0) {} - void finish(int r) { complete(r); } + void finish(int r) override { complete(r); } /// We overload complete in order to not delete the context - void complete(int r) { + void complete(int r) override { Mutex::Locker l(lock); done = true; rval = r; diff --git a/src/common/ContextCompletion.h b/src/common/ContextCompletion.h index 2cf5d55cb0c0..a8b5b689f00f 100644 --- a/src/common/ContextCompletion.h +++ b/src/common/ContextCompletion.h @@ -34,7 +34,7 @@ public: m_context_completion.start_op(); } - virtual void finish(int r) { + void finish(int r) override { m_context_completion.finish_op(r); } diff --git a/src/common/Continuation.h b/src/common/Continuation.h index 856c6b8b47f6..394856973ab6 100644 --- a/src/common/Continuation.h +++ b/src/common/Continuation.h @@ -58,7 +58,7 @@ class Continuation { Callback(Continuation *c, int stage) : continuation(c), stage_to_activate(stage) {} - void finish(int r) { + void finish(int r) override { continuation->continue_function(r, stage_to_activate); } }; diff --git a/src/common/Finisher.h b/src/common/Finisher.h index ffdddf632e8d..5947fa77df14 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -63,7 +63,7 @@ class Finisher { struct FinisherThread : public Thread { Finisher *fin; explicit FinisherThread(Finisher *f) : fin(f) {} - void* entry() { return (void*)fin->finisher_thread_entry(); } + void* entry() override { return (void*)fin->finisher_thread_entry(); } } finisher_thread; public: @@ -174,14 +174,14 @@ public: assert(con != NULL); } - ~C_OnFinisher() { + ~C_OnFinisher() override { if (con != nullptr) { delete con; con = nullptr; } } - void finish(int r) { + void finish(int r) override { fin->queue(con, r); con = nullptr; } diff --git a/src/common/Formatter.h b/src/common/Formatter.h index d2c3df26d842..a4cf3e13cd58 100644 --- a/src/common/Formatter.h +++ b/src/common/Formatter.h @@ -93,25 +93,25 @@ namespace ceph { public: explicit JSONFormatter(bool p = false); - virtual void set_status(int status, const char* status_name) {}; - virtual void output_header() {}; - virtual void output_footer() {}; - void flush(std::ostream& os); + void set_status(int status, const char* status_name) override {}; + void output_header() override {}; + void output_footer() override {}; + void flush(std::ostream& os) override; using Formatter::flush; // don't hide Formatter::flush(bufferlist &bl) - void reset(); - virtual void open_array_section(const char *name); - void open_array_section_in_ns(const char *name, const char *ns); - void open_object_section(const char *name); - void open_object_section_in_ns(const char *name, const char *ns); - void close_section(); - void dump_unsigned(const char *name, uint64_t u); - void dump_int(const char *name, int64_t u); - void dump_float(const char *name, double d); - void dump_string(const char *name, const std::string& s); - std::ostream& dump_stream(const char *name); - void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap); - int get_len() const; - void write_raw_data(const char *data); + void reset() override; + void open_array_section(const char *name) override; + void open_array_section_in_ns(const char *name, const char *ns) override; + void open_object_section(const char *name) override; + void open_object_section_in_ns(const char *name, const char *ns) override; + void close_section() override; + void dump_unsigned(const char *name, uint64_t u) override; + void dump_int(const char *name, int64_t u) override; + void dump_float(const char *name, double d) override; + void dump_string(const char *name, const std::string& s) override; + std::ostream& dump_stream(const char *name) override; + void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap) override; + int get_len() const override; + void write_raw_data(const char *data) override; private: @@ -138,31 +138,31 @@ namespace ceph { static const char *XML_1_DTD; XMLFormatter(bool pretty = false, bool lowercased = false, bool underscored = true); - virtual void set_status(int status, const char* status_name) {} - virtual void output_header(); - virtual void output_footer(); + void set_status(int status, const char* status_name) override {} + void output_header() override; + void output_footer() override; - void flush(std::ostream& os); + void flush(std::ostream& os) override; using Formatter::flush; // don't hide Formatter::flush(bufferlist &bl) - void reset(); - void open_array_section(const char *name); - void open_array_section_in_ns(const char *name, const char *ns); - void open_object_section(const char *name); - void open_object_section_in_ns(const char *name, const char *ns); - void close_section(); - void dump_unsigned(const char *name, uint64_t u); - void dump_int(const char *name, int64_t u); - void dump_float(const char *name, double d); - void dump_string(const char *name, const std::string& s); - std::ostream& dump_stream(const char *name); - void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap); - int get_len() const; - void write_raw_data(const char *data); + void reset() override; + void open_array_section(const char *name) override; + void open_array_section_in_ns(const char *name, const char *ns) override; + void open_object_section(const char *name) override; + void open_object_section_in_ns(const char *name, const char *ns) override; + void close_section() override; + void dump_unsigned(const char *name, uint64_t u) override; + void dump_int(const char *name, int64_t u) override; + void dump_float(const char *name, double d) override; + void dump_string(const char *name, const std::string& s) override; + std::ostream& dump_stream(const char *name) override; + void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap) override; + int get_len() const override; + void write_raw_data(const char *data) override; /* with attrs */ - void open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs); - void open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs); - void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs); + void open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs) override; + void open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs) override; + void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs) override; protected: void open_section_in_ns(const char *name, const char *ns, const FormatterAttrs *attrs); @@ -185,31 +185,31 @@ namespace ceph { public: explicit TableFormatter(bool keyval = false); - virtual void set_status(int status, const char* status_name) {}; - virtual void output_header() {}; - virtual void output_footer() {}; - void flush(std::ostream& os); + void set_status(int status, const char* status_name) override {}; + void output_header() override {}; + void output_footer() override {}; + void flush(std::ostream& os) override; using Formatter::flush; // don't hide Formatter::flush(bufferlist &bl) - void reset(); - virtual void open_array_section(const char *name); - void open_array_section_in_ns(const char *name, const char *ns); - void open_object_section(const char *name); - void open_object_section_in_ns(const char *name, const char *ns); - - void open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs); - void open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs); - - void close_section(); - void dump_unsigned(const char *name, uint64_t u); - void dump_int(const char *name, int64_t u); - void dump_float(const char *name, double d); - void dump_string(const char *name, const std::string& s); - void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap); - void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs); - std::ostream& dump_stream(const char *name); - - int get_len() const; - void write_raw_data(const char *data); + void reset() override; + void open_array_section(const char *name) override; + void open_array_section_in_ns(const char *name, const char *ns) override; + void open_object_section(const char *name) override; + void open_object_section_in_ns(const char *name, const char *ns) override; + + void open_array_section_with_attrs(const char *name, const FormatterAttrs& attrs) override; + void open_object_section_with_attrs(const char *name, const FormatterAttrs& attrs) override; + + void close_section() override; + void dump_unsigned(const char *name, uint64_t u) override; + void dump_int(const char *name, int64_t u) override; + void dump_float(const char *name, double d) override; + void dump_string(const char *name, const std::string& s) override; + void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap) override; + void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs) override; + std::ostream& dump_stream(const char *name) override; + + int get_len() const override; + void write_raw_data(const char *data) override; void get_attrs_str(const FormatterAttrs *attrs, std::string& attrs_str); private: diff --git a/src/common/HTMLFormatter.h b/src/common/HTMLFormatter.h index 69c82a537f39..23fc8765599a 100644 --- a/src/common/HTMLFormatter.h +++ b/src/common/HTMLFormatter.h @@ -21,21 +21,21 @@ namespace ceph { class HTMLFormatter : public XMLFormatter { public: explicit HTMLFormatter(bool pretty = false); - ~HTMLFormatter(); - void reset(); + ~HTMLFormatter() override; + void reset() override; - virtual void set_status(int status, const char* status_name); - virtual void output_header(); + void set_status(int status, const char* status_name) override; + void output_header() override; - void dump_unsigned(const char *name, uint64_t u); - void dump_int(const char *name, int64_t u); - void dump_float(const char *name, double d); - void dump_string(const char *name, const std::string& s); - std::ostream& dump_stream(const char *name); - void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap); + void dump_unsigned(const char *name, uint64_t u) override; + void dump_int(const char *name, int64_t u) override; + void dump_float(const char *name, double d) override; + void dump_string(const char *name, const std::string& s) override; + std::ostream& dump_stream(const char *name) override; + void dump_format_va(const char *name, const char *ns, bool quoted, const char *fmt, va_list ap) override; /* with attrs */ - void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs); + void dump_string_with_attrs(const char *name, const std::string& s, const FormatterAttrs& attrs) override; private: template void dump_template(const char *name, T arg); diff --git a/src/common/OutputDataSocket.h b/src/common/OutputDataSocket.h index f581a56bf031..44490679fbf1 100644 --- a/src/common/OutputDataSocket.h +++ b/src/common/OutputDataSocket.h @@ -30,7 +30,7 @@ class OutputDataSocket : public Thread { public: OutputDataSocket(CephContext *cct, uint64_t _backlog); - virtual ~OutputDataSocket(); + ~OutputDataSocket() override; bool init(const std::string &path); @@ -43,7 +43,7 @@ protected: std::string create_shutdown_pipe(int *pipe_rd, int *pipe_wr); std::string bind_and_listen(const std::string &sock_path, int *fd); - void *entry(); + void *entry() override; bool do_accept(); void handle_connection(int fd); diff --git a/src/common/PrebufferedStreambuf.h b/src/common/PrebufferedStreambuf.h index ac123810b6bc..55012d12ea49 100644 --- a/src/common/PrebufferedStreambuf.h +++ b/src/common/PrebufferedStreambuf.h @@ -30,10 +30,10 @@ public: PrebufferedStreambuf(char *buf, size_t len); // called when the buffer fills up - int_type overflow(int_type c); + int_type overflow(int_type c) override; // called when we read and need more data - int_type underflow(); + int_type underflow() override; /// return a string copy (inefficiently) std::string get_str() const; diff --git a/src/common/PrioritizedQueue.h b/src/common/PrioritizedQueue.h index a831be52fdb4..a1f23f1f86cc 100644 --- a/src/common/PrioritizedQueue.h +++ b/src/common/PrioritizedQueue.h @@ -237,7 +237,7 @@ public: min_cost(min_c) {} - unsigned length() const override final { + unsigned length() const final { unsigned total = 0; for (typename SubQueues::const_iterator i = queue.begin(); i != queue.end(); @@ -255,7 +255,7 @@ public: } void remove_by_filter( - std::function f) override final { + std::function f) final { for (typename SubQueues::iterator i = queue.begin(); i != queue.end(); ) { @@ -281,7 +281,7 @@ public: } } - void remove_by_class(K k, std::list *out = 0) override final { + void remove_by_class(K k, std::list *out = 0) final { for (typename SubQueues::iterator i = queue.begin(); i != queue.end(); ) { @@ -306,15 +306,15 @@ public: } } - void enqueue_strict(K cl, unsigned priority, T item) override final { + void enqueue_strict(K cl, unsigned priority, T item) final { high_queue[priority].enqueue(cl, 0, item); } - void enqueue_strict_front(K cl, unsigned priority, T item) override final { + void enqueue_strict_front(K cl, unsigned priority, T item) final { high_queue[priority].enqueue_front(cl, 0, item); } - void enqueue(K cl, unsigned priority, unsigned cost, T item) override final { + void enqueue(K cl, unsigned priority, unsigned cost, T item) final { if (cost < min_cost) cost = min_cost; if (cost > max_tokens_per_subqueue) @@ -322,7 +322,7 @@ public: create_queue(priority)->enqueue(cl, cost, item); } - void enqueue_front(K cl, unsigned priority, unsigned cost, T item) override final { + void enqueue_front(K cl, unsigned priority, unsigned cost, T item) final { if (cost < min_cost) cost = min_cost; if (cost > max_tokens_per_subqueue) @@ -330,13 +330,13 @@ public: create_queue(priority)->enqueue_front(cl, cost, item); } - bool empty() const override final { + bool empty() const final { assert(total_priority >= 0); assert((total_priority == 0) || !(queue.empty())); return queue.empty() && high_queue.empty(); } - T dequeue() override final { + T dequeue() final { assert(!empty()); if (!(high_queue.empty())) { @@ -380,7 +380,7 @@ public: return ret; } - void dump(ceph::Formatter *f) const override final { + void dump(ceph::Formatter *f) const final { f->dump_int("total_priority", total_priority); f->dump_int("max_tokens_per_subqueue", max_tokens_per_subqueue); f->dump_int("min_cost", min_cost); diff --git a/src/common/SubProcess.h b/src/common/SubProcess.h index 0630a4681429..2295aade48a3 100644 --- a/src/common/SubProcess.h +++ b/src/common/SubProcess.h @@ -116,7 +116,7 @@ public: int timeout = 0, int sigkill = SIGKILL); protected: - virtual void exec(); + void exec() override; private: int timeout; diff --git a/src/common/Throttle.h b/src/common/Throttle.h index 96768aadccf4..b07c9e47923c 100644 --- a/src/common/Throttle.h +++ b/src/common/Throttle.h @@ -264,7 +264,7 @@ public: } protected: - virtual void finish(int r); + void finish(int r) override; private: OrderedThrottle *m_ordered_throttle; diff --git a/src/common/TracepointProvider.h b/src/common/TracepointProvider.h index 6454f45a8c54..9efc482c6ef8 100644 --- a/src/common/TracepointProvider.h +++ b/src/common/TracepointProvider.h @@ -52,7 +52,7 @@ public: TracepointProvider(CephContext *cct, const char *library, const char *config_key); - virtual ~TracepointProvider(); + ~TracepointProvider() override; template static void initialize(CephContext *cct) { @@ -63,11 +63,11 @@ public: } protected: - virtual const char** get_tracked_conf_keys() const { + const char** get_tracked_conf_keys() const override { return m_config_keys; } - virtual void handle_conf_change(const struct md_config_t *conf, - const std::set &changed); + void handle_conf_change(const struct md_config_t *conf, + const std::set &changed) override; private: CephContext *m_cct; diff --git a/src/common/WeightedPriorityQueue.h b/src/common/WeightedPriorityQueue.h index bef8bc01dbc0..10d6f0d4514e 100644 --- a/src/common/WeightedPriorityQueue.h +++ b/src/common/WeightedPriorityQueue.h @@ -335,30 +335,30 @@ class WeightedPriorityQueue : public OpQueue { std::srand(time(0)); } - unsigned length() const override final { + unsigned length() const final { return strict.size + normal.size; } - void remove_by_filter(std::function f) override final { + void remove_by_filter(std::function f) final { strict.filter_list_pairs(f); normal.filter_list_pairs(f); } - void remove_by_class(K cl, std::list* removed = 0) override final { + void remove_by_class(K cl, std::list* removed = 0) final { strict.filter_class(cl, removed); normal.filter_class(cl, removed); } - bool empty() const override final { + bool empty() const final { return !(strict.size + normal.size); } - void enqueue_strict(K cl, unsigned p, T item) override final { + void enqueue_strict(K cl, unsigned p, T item) final { strict.insert(p, cl, 0, item); } - void enqueue_strict_front(K cl, unsigned p, T item) override final { + void enqueue_strict_front(K cl, unsigned p, T item) final { strict.insert(p, cl, 0, item, true); } - void enqueue(K cl, unsigned p, unsigned cost, T item) override final { + void enqueue(K cl, unsigned p, unsigned cost, T item) final { normal.insert(p, cl, cost, item); } - void enqueue_front(K cl, unsigned p, unsigned cost, T item) override final { + void enqueue_front(K cl, unsigned p, unsigned cost, T item) final { normal.insert(p, cl, cost, item, true); } T dequeue() override { diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index 18427b48c0ca..d67d84ef7fae 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -87,11 +87,11 @@ private: string _thread_num_option; const char **_conf_keys; - const char **get_tracked_conf_keys() const { + const char **get_tracked_conf_keys() const override { return _conf_keys; } void handle_conf_change(const struct md_config_t *conf, - const std::set &changed); + const std::set &changed) override; public: /** @brief Work queue that processes several submitted items at once. @@ -107,7 +107,7 @@ public: virtual void _process_finish(const list &) {} // virtual methods from WorkQueue_ below - void *_void_dequeue() { + void *_void_dequeue() override { list *out(new list); _dequeue(out); if (!out->empty()) { @@ -117,10 +117,10 @@ public: return 0; } } - void _void_process(void *p, TPHandle &handle) { + void _void_process(void *p, TPHandle &handle) override { _process(*((list*)p), handle); } - void _void_process_finish(void *p) { + void _void_process_finish(void *p) override { _process_finish(*(list*)p); delete (list *)p; } @@ -133,7 +133,7 @@ public: : WorkQueue_(std::move(n), ti, sti), pool(p) { pool->add_work_queue(this); } - ~BatchWorkQueue() { + ~BatchWorkQueue() override { pool->remove_work_queue(this); } @@ -186,11 +186,11 @@ public: list to_finish; virtual void _enqueue(T) = 0; virtual void _enqueue_front(T) = 0; - virtual bool _empty() = 0; + bool _empty() override = 0; virtual U _dequeue() = 0; virtual void _process_finish(U) {} - void *_void_dequeue() { + void *_void_dequeue() override { { Mutex::Locker l(_lock); if (_empty()) @@ -200,7 +200,7 @@ public: } return ((void*)1); // Not used } - void _void_process(void *, TPHandle &handle) { + void _void_process(void *, TPHandle &handle) override { _lock.Lock(); assert(!to_process.empty()); U u = to_process.front(); @@ -214,7 +214,7 @@ public: _lock.Unlock(); } - void _void_process_finish(void *) { + void _void_process_finish(void *) override { _lock.Lock(); assert(!to_finish.empty()); U u = to_finish.front(); @@ -224,14 +224,14 @@ public: _process_finish(u); } - void _clear() {} + void _clear() override {} public: WorkQueueVal(string n, time_t ti, time_t sti, ThreadPool *p) : WorkQueue_(std::move(n), ti, sti), _lock("WorkQueueVal::lock"), pool(p) { pool->add_work_queue(this); } - ~WorkQueueVal() { + ~WorkQueueVal() override { pool->remove_work_queue(this); } void queue(T item) { @@ -275,13 +275,13 @@ public: virtual void _process_finish(T *) {} // implementation of virtual methods from WorkQueue_ - void *_void_dequeue() { + void *_void_dequeue() override { return (void *)_dequeue(); } - void _void_process(void *p, TPHandle &handle) { + void _void_process(void *p, TPHandle &handle) override { _process(static_cast(p), handle); } - void _void_process_finish(void *p) { + void _void_process_finish(void *p) override { _process_finish(static_cast(p)); } @@ -294,7 +294,7 @@ public: : WorkQueue_(std::move(n), ti, sti), pool(p) { pool->add_work_queue(this); } - ~WorkQueue() { + ~WorkQueue() override { pool->remove_work_queue(this); } @@ -346,7 +346,7 @@ public: template class PointerWQ : public WorkQueue_ { public: - ~PointerWQ() { + ~PointerWQ() override { m_pool->remove_work_queue(this); assert(m_processing == 0); } @@ -374,15 +374,15 @@ public: PointerWQ(string n, time_t ti, time_t sti, ThreadPool* p) : WorkQueue_(std::move(n), ti, sti), m_pool(p), m_processing(0) { } - virtual void _clear() { + void _clear() override { assert(m_pool->_lock.is_locked()); m_items.clear(); } - virtual bool _empty() { + bool _empty() override { assert(m_pool->_lock.is_locked()); return m_items.empty(); } - virtual void *_void_dequeue() { + void *_void_dequeue() override { assert(m_pool->_lock.is_locked()); if (m_items.empty()) { return NULL; @@ -393,10 +393,10 @@ public: m_items.pop_front(); return item; } - virtual void _void_process(void *item, ThreadPool::TPHandle &handle) { + void _void_process(void *item, ThreadPool::TPHandle &handle) override { process(reinterpret_cast(item)); } - virtual void _void_process_finish(void *item) { + void _void_process_finish(void *item) override { assert(m_pool->_lock.is_locked()); assert(m_processing > 0); --m_processing; @@ -442,7 +442,7 @@ private: ThreadPool *pool; // cppcheck-suppress noExplicitConstructor WorkThread(ThreadPool *p) : pool(p) {} - void *entry() { + void *entry() override { pool->worker(this); return 0; } @@ -458,7 +458,7 @@ private: public: ThreadPool(CephContext *cct_, string nm, string tn, int n, const char *option = NULL); - virtual ~ThreadPool(); + ~ThreadPool() override; /// return number of threads currently running int get_num_threads() { @@ -565,7 +565,7 @@ class C_QueueInWQ : public Context { public: C_QueueInWQ(GenContextWQ *wq, GenContext *c) : wq(wq), c(c) {} - void finish(int) { + void finish(int) override { wq->queue(c); } }; @@ -588,14 +588,14 @@ public: ThreadPool::PointerWQ::queue(ctx); } protected: - virtual void _clear() { + void _clear() override { ThreadPool::PointerWQ::_clear(); Mutex::Locker locker(m_lock); m_context_results.clear(); } - virtual void process(Context *ctx) { + void process(Context *ctx) override { int result = 0; { Mutex::Locker locker(m_lock); @@ -658,7 +658,7 @@ public: sharded_pool(tp) { tp->set_wq(this); } - virtual ~ShardedWQ() {} + ~ShardedWQ() override {} void queue(T item) { _enqueue(item); @@ -681,7 +681,7 @@ private: uint32_t thread_index; WorkThreadSharded(ShardedThreadPool *p, uint32_t pthread_index): pool(p), thread_index(pthread_index) {} - void *entry() { + void *entry() override { pool->shardedthreadpool_worker(thread_index); return 0; } diff --git a/src/common/admin_socket.h b/src/common/admin_socket.h index 252647147e9b..2529d547a772 100644 --- a/src/common/admin_socket.h +++ b/src/common/admin_socket.h @@ -40,7 +40,7 @@ class AdminSocket : public Thread { public: AdminSocket(CephContext *cct); - virtual ~AdminSocket(); + ~AdminSocket() override; /** * register an admin socket command @@ -89,7 +89,7 @@ private: std::string destroy_shutdown_pipe(); std::string bind_and_listen(const std::string &sock_path, int *fd); - void *entry(); + void *entry() override; bool do_accept(); CephContext *m_cct; diff --git a/src/common/bloom_filter.hpp b/src/common/bloom_filter.hpp index 8e826c4af6db..286a96589c6b 100644 --- a/src/common/bloom_filter.hpp +++ b/src/common/bloom_filter.hpp @@ -557,7 +557,7 @@ public: size_list.push_back(table_size_); } - inline virtual std::size_t size() const + inline std::size_t size() const override { return size_list.back() * bits_per_char; } @@ -601,7 +601,7 @@ public: return true; } - virtual inline double approx_unique_element_count() const { + inline double approx_unique_element_count() const override { // this is not a very good estimate; a better solution should have // some asymptotic behavior as density() approaches 1.0. // @@ -611,7 +611,7 @@ public: private: - inline virtual void compute_indices(const bloom_type& hash, std::size_t& bit_index, std::size_t& bit) const + inline void compute_indices(const bloom_type& hash, std::size_t& bit_index, std::size_t& bit) const override { bit_index = hash; for (std::size_t i = 0; i < size_list.size(); ++i) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 2de7e1661b3d..56b5770fa012 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -255,7 +255,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; inc_total_alloc(len); inc_history_alloc(len); } - ~raw_combined() { + ~raw_combined() override { dec_total_alloc(len); } raw* clone_empty() override { @@ -309,7 +309,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; inc_total_alloc(len); bdout << "raw_malloc " << this << " alloc " << (void *)data << " " << l << " " << buffer::get_total_alloc() << bendl; } - ~raw_malloc() { + ~raw_malloc() override { free(data); dec_total_alloc(len); bdout << "raw_malloc " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; @@ -332,7 +332,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; inc_history_alloc(len); bdout << "raw_mmap " << this << " alloc " << (void *)data << " " << l << " " << buffer::get_total_alloc() << bendl; } - ~raw_mmap_pages() { + ~raw_mmap_pages() override { ::munmap(data, len); dec_total_alloc(len); bdout << "raw_mmap " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; @@ -357,7 +357,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; inc_history_alloc(len); bdout << "raw_posix_aligned " << this << " alloc " << (void *)data << " l=" << l << ", align=" << align << " total_alloc=" << buffer::get_total_alloc() << bendl; } - ~raw_posix_aligned() { + ~raw_posix_aligned() override { mempool::buffer_data::alloc_char.deallocate_aligned(data, len); dec_total_alloc(len); bdout << "raw_posix_aligned " << this << " free " << (void *)data << " " << buffer::get_total_alloc() << bendl; @@ -439,7 +439,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; << buffer::get_total_alloc() << bendl; } - ~raw_pipe() { + ~raw_pipe() override { if (data) free(data); close_pipe(pipefds); @@ -595,7 +595,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; inc_total_alloc(len); bdout << "raw_char " << this << " alloc " << (void *)data << " " << l << " " << buffer::get_total_alloc() << bendl; } - ~raw_char() { + ~raw_char() override { if (data) mempool::buffer_data::alloc_char.deallocate(data, len); dec_total_alloc(len); @@ -624,7 +624,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; bool is_shareable() override { return false; // !shareable, will force make_shareable() } - ~raw_unshareable() { + ~raw_unshareable() override { delete[] data; } }; @@ -634,7 +634,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; MEMPOOL_CLASS_HELPERS(); raw_static(const char *d, unsigned l) : raw((char*)d, l) { } - ~raw_static() {} + ~raw_static() override {} raw* clone_empty() override { return new buffer::raw_char(len); } @@ -645,7 +645,7 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; public: raw_claim_buffer(const char *b, unsigned l, deleter d) : raw((char*)b, l), del(std::move(d)) { } - ~raw_claim_buffer() {} + ~raw_claim_buffer() override {} raw* clone_empty() override { return new buffer::raw_char(len); } diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 689ecca451f7..a63858e2b3b8 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -51,7 +51,7 @@ class LockdepObs : public md_config_obs_t { public: explicit LockdepObs(CephContext *cct) : m_cct(cct), m_registered(false) { } - ~LockdepObs() { + ~LockdepObs() override { if (m_registered) { lockdep_unregister_ceph_context(m_cct); } @@ -91,7 +91,7 @@ public: "get mempool stats"); assert(r == 0); } - ~MempoolObs() { + ~MempoolObs() override { cct->_conf->remove_observer(this); cct->get_admin_socket()->unregister_command("dump_mempools"); } @@ -138,7 +138,7 @@ public: { } - ~CephContextServiceThread() {} + ~CephContextServiceThread() override {} void *entry() override { diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 761094aa99b0..0026b6851dd6 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -213,7 +213,7 @@ private: struct TypedSingletonWrapper : public SingletonWrapper { TypedSingletonWrapper(T *p) : singleton(p) { } - virtual ~TypedSingletonWrapper() { + ~TypedSingletonWrapper() override { delete singleton; } diff --git a/src/common/ceph_json.h b/src/common/ceph_json.h index b3961cc78326..18cf06fd4f19 100644 --- a/src/common/ceph_json.h +++ b/src/common/ceph_json.h @@ -88,7 +88,7 @@ class JSONParser : public JSONObj bool success; public: JSONParser(); - virtual ~JSONParser(); + ~JSONParser() override; void handle_data(const char *s, int len); bool parse(const char *buf_, int len); diff --git a/src/common/deleter.h b/src/common/deleter.h index 6671f6b0e7a2..a13cf1f92dd2 100644 --- a/src/common/deleter.h +++ b/src/common/deleter.h @@ -140,7 +140,7 @@ struct lambda_deleter_impl final : deleter::impl { Deleter del; lambda_deleter_impl(deleter next, Deleter&& del) : impl(std::move(next)), del(std::move(del)) {} - virtual ~lambda_deleter_impl() override { del(); } + ~lambda_deleter_impl() override { del(); } }; template @@ -183,7 +183,7 @@ deleter make_deleter(Object o) { struct free_deleter_impl final : deleter::impl { void* obj; free_deleter_impl(void* obj) : impl(deleter()), obj(obj) {} - virtual ~free_deleter_impl() override { std::free(obj); } + ~free_deleter_impl() override { std::free(obj); } }; /// \endcond diff --git a/src/compressor/AsyncCompressor.h b/src/compressor/AsyncCompressor.h index 9744b0c9caba..3c453f82ceb3 100644 --- a/src/compressor/AsyncCompressor.h +++ b/src/compressor/AsyncCompressor.h @@ -58,17 +58,17 @@ class AsyncCompressor { CompressWQ(AsyncCompressor *ac, time_t timeout, time_t suicide_timeout, ThreadPool *tp) : ThreadPool::WorkQueue("AsyncCompressor::CompressWQ", timeout, suicide_timeout, tp), async_compressor(ac) {} - bool _enqueue(Job *item) { + bool _enqueue(Job *item) override { job_queue.push_back(item); return true; } - void _dequeue(Job *item) { + void _dequeue(Job *item) override { ceph_abort(); } - bool _empty() { + bool _empty() override { return job_queue.empty(); } - Job* _dequeue() { + Job* _dequeue() override { if (job_queue.empty()) return NULL; Job *item = NULL; @@ -100,8 +100,8 @@ class AsyncCompressor { item->status.set(ERROR); } } - void _process_finish(Job *item) {} - void _clear() {} + void _process_finish(Job *item) override {} + void _clear() override {} } compress_wq; friend class CompressWQ; void _compress(bufferlist &in, bufferlist &out); diff --git a/src/compressor/CompressionPlugin.h b/src/compressor/CompressionPlugin.h index 299840aa3ffc..d2e253f2dc10 100644 --- a/src/compressor/CompressionPlugin.h +++ b/src/compressor/CompressionPlugin.h @@ -33,7 +33,7 @@ namespace ceph { compressor(0) {} - virtual ~CompressionPlugin() {} + ~CompressionPlugin() override {} virtual int factory(CompressorRef *cs, std::ostream *ss) = 0; diff --git a/src/compressor/snappy/CompressionPluginSnappy.h b/src/compressor/snappy/CompressionPluginSnappy.h index a744a5df137f..758d606e0e65 100644 --- a/src/compressor/snappy/CompressionPluginSnappy.h +++ b/src/compressor/snappy/CompressionPluginSnappy.h @@ -27,8 +27,8 @@ public: explicit CompressionPluginSnappy(CephContext* cct) : CompressionPlugin(cct) {} - virtual int factory(CompressorRef *cs, - std::ostream *ss) + int factory(CompressorRef *cs, + std::ostream *ss) override { if (compressor == 0) { SnappyCompressor *interface = new SnappyCompressor(); diff --git a/src/compressor/zlib/CompressionPluginZlib.h b/src/compressor/zlib/CompressionPluginZlib.h index 18692a3eedde..b27ec87104f5 100644 --- a/src/compressor/zlib/CompressionPluginZlib.h +++ b/src/compressor/zlib/CompressionPluginZlib.h @@ -32,8 +32,8 @@ public: explicit CompressionPluginZlib(CephContext *cct) : CompressionPlugin(cct) {} - virtual int factory(CompressorRef *cs, - std::ostream *ss) + int factory(CompressorRef *cs, + std::ostream *ss) override { bool isal; if (cct->_conf->compressor_zlib_isal) { diff --git a/src/compressor/zstd/CompressionPluginZstd.h b/src/compressor/zstd/CompressionPluginZstd.h index 59c52cfeeaed..c85951705a40 100644 --- a/src/compressor/zstd/CompressionPluginZstd.h +++ b/src/compressor/zstd/CompressionPluginZstd.h @@ -28,8 +28,8 @@ public: explicit CompressionPluginZstd(CephContext* cct) : CompressionPlugin(cct) {} - virtual int factory(CompressorRef *cs, - std::ostream *ss) + int factory(CompressorRef *cs, + std::ostream *ss) override { if (compressor == 0) { ZstdCompressor *interface = new ZstdCompressor(); diff --git a/src/crush/CrushTreeDumper.h b/src/crush/CrushTreeDumper.h index 41cf1a9af4ea..3286fc72c318 100644 --- a/src/crush/CrushTreeDumper.h +++ b/src/crush/CrushTreeDumper.h @@ -158,7 +158,7 @@ namespace CrushTreeDumper { explicit FormattingDumper(const CrushWrapper *crush) : Dumper(crush) {} protected: - virtual void dump_item(const Item &qi, Formatter *f) { + void dump_item(const Item &qi, Formatter *f) override { f->open_object_section("item"); dump_item_fields(qi, f); dump_bucket_children(qi, f); diff --git a/src/erasure-code/ErasureCode.h b/src/erasure-code/ErasureCode.h index bad6d8140f37..6ca39d6f9834 100644 --- a/src/erasure-code/ErasureCode.h +++ b/src/erasure-code/ErasureCode.h @@ -35,50 +35,50 @@ namespace ceph { vector chunk_mapping; ErasureCodeProfile _profile; - virtual ~ErasureCode() {} + ~ErasureCode() override {} - virtual int init(ErasureCodeProfile &profile, ostream *ss) { + int init(ErasureCodeProfile &profile, ostream *ss) override { _profile = profile; return 0; } - virtual const ErasureCodeProfile &get_profile() const { + const ErasureCodeProfile &get_profile() const override { return _profile; } int sanity_check_k(int k, ostream *ss); - virtual unsigned int get_coding_chunk_count() const { + unsigned int get_coding_chunk_count() const override { return get_chunk_count() - get_data_chunk_count(); } - virtual int minimum_to_decode(const set &want_to_read, + int minimum_to_decode(const set &want_to_read, const set &available_chunks, - set *minimum); + set *minimum) override; - virtual int minimum_to_decode_with_cost(const set &want_to_read, + int minimum_to_decode_with_cost(const set &want_to_read, const map &available, - set *minimum); + set *minimum) override; int encode_prepare(const bufferlist &raw, map &encoded) const; - virtual int encode(const set &want_to_encode, + int encode(const set &want_to_encode, const bufferlist &in, - map *encoded); + map *encoded) override; - virtual int encode_chunks(const set &want_to_encode, - map *encoded); + int encode_chunks(const set &want_to_encode, + map *encoded) override; - virtual int decode(const set &want_to_read, + int decode(const set &want_to_read, const map &chunks, - map *decoded); + map *decoded) override; - virtual int decode_chunks(const set &want_to_read, + int decode_chunks(const set &want_to_read, const map &chunks, - map *decoded); + map *decoded) override; - virtual const vector &get_chunk_mapping() const; + const vector &get_chunk_mapping() const override; int to_mapping(const ErasureCodeProfile &profile, ostream *ss); @@ -101,8 +101,8 @@ namespace ceph { const std::string &default_value, ostream *ss); - virtual int decode_concat(const map &chunks, - bufferlist *decoded); + int decode_concat(const map &chunks, + bufferlist *decoded) override; protected: int parse(const ErasureCodeProfile &profile, diff --git a/src/erasure-code/isa/ErasureCodeIsa.h b/src/erasure-code/isa/ErasureCodeIsa.h index 63aa5f340360..17ba4ff30e00 100644 --- a/src/erasure-code/isa/ErasureCodeIsa.h +++ b/src/erasure-code/isa/ErasureCodeIsa.h @@ -64,37 +64,37 @@ public: { } - virtual - ~ErasureCodeIsa() + + ~ErasureCodeIsa() override { } - virtual int create_ruleset(const string &name, + int create_ruleset(const string &name, CrushWrapper &crush, - ostream *ss) const; + ostream *ss) const override; - virtual unsigned int - get_chunk_count() const + unsigned int + get_chunk_count() const override { return k + m; } - virtual unsigned int - get_data_chunk_count() const + unsigned int + get_data_chunk_count() const override { return k; } - virtual unsigned int get_chunk_size(unsigned int object_size) const; + unsigned int get_chunk_size(unsigned int object_size) const override; - virtual int encode_chunks(const set &want_to_encode, - map *encoded); + int encode_chunks(const set &want_to_encode, + map *encoded) override; - virtual int decode_chunks(const set &want_to_read, + int decode_chunks(const set &want_to_read, const map &chunks, - map *decoded); + map *decoded) override; - virtual int init(ErasureCodeProfile &profile, ostream *ss); + int init(ErasureCodeProfile &profile, ostream *ss) override; virtual void isa_encode(char **data, char **coding, @@ -138,30 +138,30 @@ public: matrixtype = matrix; } - virtual - ~ErasureCodeIsaDefault() + + ~ErasureCodeIsaDefault() override { } - virtual void isa_encode(char **data, + void isa_encode(char **data, char **coding, - int blocksize); + int blocksize) override; virtual bool erasure_contains(int *erasures, int i); - virtual int isa_decode(int *erasures, + int isa_decode(int *erasures, char **data, char **coding, - int blocksize); + int blocksize) override; - virtual unsigned get_alignment() const; + unsigned get_alignment() const override; - virtual void prepare(); + void prepare() override; private: - virtual int parse(ErasureCodeProfile &profile, - ostream *ss); + int parse(ErasureCodeProfile &profile, + ostream *ss) override; }; #endif diff --git a/src/erasure-code/isa/ErasureCodePluginIsa.h b/src/erasure-code/isa/ErasureCodePluginIsa.h index 7ed5aed6645a..cbe841a6d7cb 100644 --- a/src/erasure-code/isa/ErasureCodePluginIsa.h +++ b/src/erasure-code/isa/ErasureCodePluginIsa.h @@ -25,10 +25,10 @@ class ErasureCodePluginIsa : public ErasureCodePlugin { public: ErasureCodeIsaTableCache tcache; - virtual int factory(const std::string &directory, + int factory(const std::string &directory, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream *ss); + ostream *ss) override; }; #endif diff --git a/src/erasure-code/jerasure/ErasureCodeJerasure.h b/src/erasure-code/jerasure/ErasureCodeJerasure.h index 31d049fbe9d5..da341175ecc5 100644 --- a/src/erasure-code/jerasure/ErasureCodeJerasure.h +++ b/src/erasure-code/jerasure/ErasureCodeJerasure.h @@ -49,30 +49,30 @@ public: per_chunk_alignment(false) {} - virtual ~ErasureCodeJerasure() {} + ~ErasureCodeJerasure() override {} - virtual int create_ruleset(const string &name, + int create_ruleset(const string &name, CrushWrapper &crush, - ostream *ss) const; + ostream *ss) const override; - virtual unsigned int get_chunk_count() const { + unsigned int get_chunk_count() const override { return k + m; } - virtual unsigned int get_data_chunk_count() const { + unsigned int get_data_chunk_count() const override { return k; } - virtual unsigned int get_chunk_size(unsigned int object_size) const; + unsigned int get_chunk_size(unsigned int object_size) const override; - virtual int encode_chunks(const set &want_to_encode, - map *encoded); + int encode_chunks(const set &want_to_encode, + map *encoded) override; - virtual int decode_chunks(const set &want_to_read, + int decode_chunks(const set &want_to_read, const map &chunks, - map *decoded); + map *decoded) override; - virtual int init(ErasureCodeProfile &profile, ostream *ss); + int init(ErasureCodeProfile &profile, ostream *ss) override; virtual void jerasure_encode(char **data, char **coding, @@ -100,22 +100,22 @@ public: DEFAULT_M = "3"; DEFAULT_W = "8"; } - virtual ~ErasureCodeJerasureReedSolomonVandermonde() { + ~ErasureCodeJerasureReedSolomonVandermonde() override { if (matrix) free(matrix); } - virtual void jerasure_encode(char **data, + void jerasure_encode(char **data, char **coding, - int blocksize); - virtual int jerasure_decode(int *erasures, + int blocksize) override; + int jerasure_decode(int *erasures, char **data, char **coding, - int blocksize); - virtual unsigned get_alignment() const; - virtual void prepare(); + int blocksize) override; + unsigned get_alignment() const override; + void prepare() override; private: - virtual int parse(ErasureCodeProfile &profile, ostream *ss); + int parse(ErasureCodeProfile &profile, ostream *ss) override; }; class ErasureCodeJerasureReedSolomonRAID6 : public ErasureCodeJerasure { @@ -129,22 +129,22 @@ public: DEFAULT_K = "7"; DEFAULT_W = "8"; } - virtual ~ErasureCodeJerasureReedSolomonRAID6() { + ~ErasureCodeJerasureReedSolomonRAID6() override { if (matrix) free(matrix); } - virtual void jerasure_encode(char **data, + void jerasure_encode(char **data, char **coding, - int blocksize); - virtual int jerasure_decode(int *erasures, + int blocksize) override; + int jerasure_decode(int *erasures, char **data, char **coding, - int blocksize); - virtual unsigned get_alignment() const; - virtual void prepare(); + int blocksize) override; + unsigned get_alignment() const override; + void prepare() override; private: - virtual int parse(ErasureCodeProfile &profile, ostream *ss); + int parse(ErasureCodeProfile &profile, ostream *ss) override; }; #define DEFAULT_PACKETSIZE "2048" @@ -165,24 +165,24 @@ public: DEFAULT_M = "3"; DEFAULT_W = "8"; } - virtual ~ErasureCodeJerasureCauchy() { + ~ErasureCodeJerasureCauchy() override { if (bitmatrix) free(bitmatrix); if (schedule) free(schedule); } - virtual void jerasure_encode(char **data, + void jerasure_encode(char **data, char **coding, - int blocksize); - virtual int jerasure_decode(int *erasures, + int blocksize) override; + int jerasure_decode(int *erasures, char **data, char **coding, - int blocksize); - virtual unsigned get_alignment() const; + int blocksize) override; + unsigned get_alignment() const override; void prepare_schedule(int *matrix); private: - virtual int parse(ErasureCodeProfile &profile, ostream *ss); + int parse(ErasureCodeProfile &profile, ostream *ss) override; }; class ErasureCodeJerasureCauchyOrig : public ErasureCodeJerasureCauchy { @@ -191,7 +191,7 @@ public: ErasureCodeJerasureCauchy("cauchy_orig") {} - virtual void prepare(); + void prepare() override; }; class ErasureCodeJerasureCauchyGood : public ErasureCodeJerasureCauchy { @@ -200,7 +200,7 @@ public: ErasureCodeJerasureCauchy("cauchy_good") {} - virtual void prepare(); + void prepare() override; }; class ErasureCodeJerasureLiberation : public ErasureCodeJerasure { @@ -219,25 +219,25 @@ public: DEFAULT_M = "2"; DEFAULT_W = "7"; } - virtual ~ErasureCodeJerasureLiberation(); + ~ErasureCodeJerasureLiberation() override; - virtual void jerasure_encode(char **data, + void jerasure_encode(char **data, char **coding, - int blocksize); - virtual int jerasure_decode(int *erasures, + int blocksize) override; + int jerasure_decode(int *erasures, char **data, char **coding, - int blocksize); - virtual unsigned get_alignment() const; + int blocksize) override; + unsigned get_alignment() const override; virtual bool check_k(ostream *ss) const; virtual bool check_w(ostream *ss) const; virtual bool check_packetsize_set(ostream *ss) const; virtual bool check_packetsize(ostream *ss) const; virtual int revert_to_default(ErasureCodeProfile &profile, ostream *ss); - virtual void prepare(); + void prepare() override; private: - virtual int parse(ErasureCodeProfile &profile, ostream *ss); + int parse(ErasureCodeProfile &profile, ostream *ss) override; }; class ErasureCodeJerasureBlaumRoth : public ErasureCodeJerasureLiberation { @@ -247,8 +247,8 @@ public: { } - virtual bool check_w(ostream *ss) const; - virtual void prepare(); + bool check_w(ostream *ss) const override; + void prepare() override; }; class ErasureCodeJerasureLiber8tion : public ErasureCodeJerasureLiberation { @@ -261,9 +261,9 @@ public: DEFAULT_W = "8"; } - virtual void prepare(); + void prepare() override; private: - virtual int parse(ErasureCodeProfile &profile, ostream *ss); + int parse(ErasureCodeProfile &profile, ostream *ss) override; }; #endif diff --git a/src/erasure-code/jerasure/ErasureCodePluginJerasure.h b/src/erasure-code/jerasure/ErasureCodePluginJerasure.h index b52da8b5b273..9b5dc2f4c52e 100644 --- a/src/erasure-code/jerasure/ErasureCodePluginJerasure.h +++ b/src/erasure-code/jerasure/ErasureCodePluginJerasure.h @@ -22,10 +22,10 @@ class ErasureCodePluginJerasure : public ErasureCodePlugin { public: - virtual int factory(const std::string& directory, + int factory(const std::string& directory, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream *ss); + ostream *ss) override; }; #endif diff --git a/src/erasure-code/lrc/ErasureCodeLrc.h b/src/erasure-code/lrc/ErasureCodeLrc.h index e54688a97bb8..c12a8ad353d1 100644 --- a/src/erasure-code/lrc/ErasureCodeLrc.h +++ b/src/erasure-code/lrc/ErasureCodeLrc.h @@ -81,37 +81,37 @@ public: ruleset_steps.push_back(Step("chooseleaf", "host", 0)); } - virtual ~ErasureCodeLrc() {} + ~ErasureCodeLrc() override {} set get_erasures(const set &need, const set &available) const; - virtual int minimum_to_decode(const set &want_to_read, + int minimum_to_decode(const set &want_to_read, const set &available, - set *minimum); + set *minimum) override; - virtual int create_ruleset(const string &name, + int create_ruleset(const string &name, CrushWrapper &crush, - ostream *ss) const; + ostream *ss) const override; - virtual unsigned int get_chunk_count() const { + unsigned int get_chunk_count() const override { return chunk_count; } - virtual unsigned int get_data_chunk_count() const { + unsigned int get_data_chunk_count() const override { return data_chunk_count; } - virtual unsigned int get_chunk_size(unsigned int object_size) const; + unsigned int get_chunk_size(unsigned int object_size) const override; - virtual int encode_chunks(const set &want_to_encode, - map *encoded); + int encode_chunks(const set &want_to_encode, + map *encoded) override; - virtual int decode_chunks(const set &want_to_read, + int decode_chunks(const set &want_to_read, const map &chunks, - map *decoded); + map *decoded) override; - virtual int init(ErasureCodeProfile &profile, ostream *ss); + int init(ErasureCodeProfile &profile, ostream *ss) override; virtual int parse(ErasureCodeProfile &profile, ostream *ss); diff --git a/src/erasure-code/lrc/ErasureCodePluginLrc.h b/src/erasure-code/lrc/ErasureCodePluginLrc.h index a0dbe74e9daf..0d38f8c701f9 100644 --- a/src/erasure-code/lrc/ErasureCodePluginLrc.h +++ b/src/erasure-code/lrc/ErasureCodePluginLrc.h @@ -22,10 +22,10 @@ class ErasureCodePluginLrc : public ErasureCodePlugin { public: - virtual int factory(const std::string &directory, + int factory(const std::string &directory, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream *ss); + ostream *ss) override; }; #endif diff --git a/src/erasure-code/shec/ErasureCodePluginShec.h b/src/erasure-code/shec/ErasureCodePluginShec.h index fa642974ea0f..72b59a466b21 100644 --- a/src/erasure-code/shec/ErasureCodePluginShec.h +++ b/src/erasure-code/shec/ErasureCodePluginShec.h @@ -25,10 +25,10 @@ class ErasureCodePluginShec : public ErasureCodePlugin { public: ErasureCodeShecTableCache tcache; - virtual int factory(const std::string &directory, + int factory(const std::string &directory, ErasureCodeProfile &profile, ErasureCodeInterfaceRef *erasure_code, - ostream *ss); + ostream *ss) override; }; #endif diff --git a/src/erasure-code/shec/ErasureCodeShec.h b/src/erasure-code/shec/ErasureCodeShec.h index bf07b8041937..b3c46014637b 100644 --- a/src/erasure-code/shec/ErasureCodeShec.h +++ b/src/erasure-code/shec/ErasureCodeShec.h @@ -68,44 +68,44 @@ public: matrix(0) {} - virtual ~ErasureCodeShec() {} + ~ErasureCodeShec() override {} - virtual int create_ruleset(const string &name, + int create_ruleset(const string &name, CrushWrapper &crush, - ostream *ss) const; + ostream *ss) const override; - virtual unsigned int get_chunk_count() const { + unsigned int get_chunk_count() const override { return k + m; } - virtual unsigned int get_data_chunk_count() const { + unsigned int get_data_chunk_count() const override { return k; } - virtual unsigned int get_chunk_size(unsigned int object_size) const; + unsigned int get_chunk_size(unsigned int object_size) const override; - virtual int minimum_to_decode(const set &want_to_read, + int minimum_to_decode(const set &want_to_read, const set &available_chunks, - set *minimum); + set *minimum) override; - virtual int minimum_to_decode_with_cost(const set &want_to_read, + int minimum_to_decode_with_cost(const set &want_to_read, const map &available, - set *minimum); + set *minimum) override; - virtual int encode(const set &want_to_encode, + int encode(const set &want_to_encode, const bufferlist &in, - map *encoded); - virtual int encode_chunks(const set &want_to_encode, - map *encoded); + map *encoded) override; + int encode_chunks(const set &want_to_encode, + map *encoded) override; - virtual int decode(const set &want_to_read, + int decode(const set &want_to_read, const map &chunks, - map *decoded); - virtual int decode_chunks(const set &want_to_read, + map *decoded) override; + int decode_chunks(const set &want_to_read, const map &chunks, - map *decoded); + map *decoded) override; - virtual int init(ErasureCodeProfile &profile, ostream *ss); + int init(ErasureCodeProfile &profile, ostream *ss) override; virtual void shec_encode(char **data, char **coding, int blocksize) = 0; @@ -140,21 +140,21 @@ public: ErasureCodeShec(technique, _tcache) {} - virtual ~ErasureCodeShecReedSolomonVandermonde() { + ~ErasureCodeShecReedSolomonVandermonde() override { } - virtual void shec_encode(char **data, + void shec_encode(char **data, char **coding, - int blocksize); - virtual int shec_decode(int *erasures, + int blocksize) override; + int shec_decode(int *erasures, int *avails, char **data, char **coding, - int blocksize); - virtual unsigned get_alignment() const; - virtual void prepare(); + int blocksize) override; + unsigned get_alignment() const override; + void prepare() override; private: - virtual int parse(const ErasureCodeProfile &profile); + int parse(const ErasureCodeProfile &profile) override; }; #endif diff --git a/src/global/signal_handler.cc b/src/global/signal_handler.cc index 2f894efd7ec8..2ddc0149893f 100644 --- a/src/global/signal_handler.cc +++ b/src/global/signal_handler.cc @@ -240,7 +240,7 @@ struct SignalHandler : public Thread { create("signal_handler"); } - ~SignalHandler() { + ~SignalHandler() override { shutdown(); } diff --git a/src/include/Context.h b/src/include/Context.h index 57250e7c006a..bf992d0a2bf9 100644 --- a/src/include/Context.h +++ b/src/include/Context.h @@ -80,7 +80,7 @@ class ContainerContext : public Context { T obj; public: ContainerContext(T &obj) : obj(obj) {} - void finish(int r) {} + void finish(int r) override {} }; template ContainerContext *make_container_context(T &&t) { @@ -92,7 +92,7 @@ struct Wrapper : public Context { Context *to_run; T val; Wrapper(Context *to_run, T val) : to_run(to_run), val(val) {} - void finish(int r) { + void finish(int r) override { if (to_run) to_run->complete(r); } @@ -111,7 +111,7 @@ template struct LambdaContext : public Context { T t; LambdaContext(T &&t) : t(std::forward(t)) {} - void finish(int) { + void finish(int) override { t(); } }; @@ -124,7 +124,7 @@ template struct LambdaGenContext : GenContext { F f; LambdaGenContext(F &&f) : f(std::forward(f)) {} - void finish(T t) { + void finish(T t) override { f(std::forward(t)); } }; @@ -180,7 +180,7 @@ inline void finish_contexts(CephContext *cct, std::vector& finished, class C_NoopContext : public Context { public: - void finish(int r) { } + void finish(int r) override { } }; @@ -188,10 +188,10 @@ struct C_Lock : public Context { Mutex *lock; Context *fin; C_Lock(Mutex *l, Context *c) : lock(l), fin(c) {} - ~C_Lock() { + ~C_Lock() override { delete fin; } - void finish(int r) { + void finish(int r) override { if (fin) { lock->Lock(); fin->complete(r); @@ -224,12 +224,12 @@ public: void take(std::list& ls) { contexts.splice(contexts.end(), ls); } - void complete(int r) { + void complete(int r) override { // Neuter any ContextInstanceType custom complete(), because although // I want to look like it, I don't actually want to run its code. Context::complete(r); } - void finish(int r) { + void finish(int r) override { finish_contexts(cct, contexts, r); } bool empty() { return contexts.empty(); } @@ -307,18 +307,18 @@ private: C_GatherBase *gather; public: C_GatherSub(C_GatherBase *g) : gather(g) {} - void complete(int r) { + void complete(int r) override { // Cancel any customized complete() functionality // from the Context subclass we're templated for, // we only want to hit that in onfinish, not at each // sub finish. e.g. MDSInternalContext. Context::complete(r); } - void finish(int r) { + void finish(int r) override { gather->sub_finish(this, r); gather = 0; } - ~C_GatherSub() { + ~C_GatherSub() override { if (gather) gather->sub_finish(this, 0); } @@ -333,7 +333,7 @@ public: { mydout(cct,10) << "C_GatherBase " << this << ".new" << dendl; } - ~C_GatherBase() { + ~C_GatherBase() override { mydout(cct,10) << "C_GatherBase " << this << ".delete" << dendl; } void set_finisher(ContextType *onfinish_) { @@ -364,7 +364,7 @@ public: mydout(cct,10) << "C_GatherBase " << this << ".new_sub is " << sub_created_count << " " << s << dendl; return s; } - void finish(int r) { + void finish(int r) override { ceph_abort(); // nobody should ever call me. } @@ -485,7 +485,7 @@ public: { } - virtual void finish(int r) { + void finish(int r) override { m_callback(r); } private: diff --git a/src/include/buffer.h b/src/include/buffer.h index a016bab4c642..4d4942adaabf 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -77,19 +77,19 @@ namespace buffer CEPH_BUFFER_API { */ struct error : public std::exception{ - const char *what() const throw (); + const char *what() const throw () override; }; struct bad_alloc : public error { - const char *what() const throw (); + const char *what() const throw () override; }; struct end_of_buffer : public error { - const char *what() const throw (); + const char *what() const throw () override; }; struct malformed_input : public error { explicit malformed_input(const std::string& w) { snprintf(buf, sizeof(buf), "buffer::malformed_input: %s", w.c_str()); } - const char *what() const throw (); + const char *what() const throw () override; private: char buf[256]; }; diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 76c01def5258..a8000e13099a 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -342,7 +342,7 @@ namespace librados time_t *unused; public: ObjectWriteOperation() : unused(NULL) {} - ~ObjectWriteOperation() {} + ~ObjectWriteOperation() override {} void mtime(time_t *pt); void mtime2(struct timespec *pts); @@ -457,7 +457,7 @@ namespace librados { public: ObjectReadOperation() {} - ~ObjectReadOperation() {} + ~ObjectReadOperation() override {} void stat(uint64_t *psize, time_t *pmtime, int *prval); void stat2(uint64_t *psize, struct timespec *pts, int *prval); diff --git a/src/journal/FutureImpl.h b/src/journal/FutureImpl.h index 96d2d24f3bc3..1c02c9a2d11e 100644 --- a/src/journal/FutureImpl.h +++ b/src/journal/FutureImpl.h @@ -89,11 +89,11 @@ private: struct C_ConsistentAck : public Context { FutureImplPtr future; C_ConsistentAck(FutureImpl *_future) : future(_future) {} - virtual void complete(int r) { + void complete(int r) override { future->consistent(r); future.reset(); } - virtual void finish(int r) {} + void finish(int r) override {} }; uint64_t m_tag_tid; diff --git a/src/journal/JournalMetadata.cc b/src/journal/JournalMetadata.cc index acbe3cb27078..3d6fcfb2eca4 100644 --- a/src/journal/JournalMetadata.cc +++ b/src/journal/JournalMetadata.cc @@ -37,7 +37,7 @@ struct C_GetClient : public Context { client_id(client_id), client(client), on_finish(on_finish) { async_op_tracker.start_op(); } - ~C_GetClient() { + ~C_GetClient() override { async_op_tracker.finish_op(); } @@ -95,7 +95,7 @@ struct C_AllocateTag : public Context { async_op_tracker.start_op(); tag->data = data; } - ~C_AllocateTag() { + ~C_AllocateTag() override { async_op_tracker.finish_op(); } @@ -216,7 +216,7 @@ struct C_GetTag : public Context { tag_tid(tag_tid), tag(tag), on_finish(on_finish) { async_op_tracker.start_op(); } - ~C_GetTag() { + ~C_GetTag() override { async_op_tracker.finish_op(); } @@ -275,7 +275,7 @@ struct C_GetTags : public Context { tags(tags), on_finish(on_finish) { async_op_tracker.start_op(); } - ~C_GetTags() { + ~C_GetTags() override { async_op_tracker.finish_op(); } @@ -357,7 +357,7 @@ struct C_AssertActiveTag : public Context { client_id(client_id), tag_tid(tag_tid), on_finish(on_finish) { async_op_tracker.start_op(); } - ~C_AssertActiveTag() { + ~C_AssertActiveTag() override { async_op_tracker.finish_op(); } diff --git a/src/journal/JournalMetadata.h b/src/journal/JournalMetadata.h index 24c3a69361fa..9eb78a644751 100644 --- a/src/journal/JournalMetadata.h +++ b/src/journal/JournalMetadata.h @@ -46,7 +46,7 @@ public: JournalMetadata(ContextWQ *work_queue, SafeTimer *timer, Mutex *timer_lock, librados::IoCtx &ioctx, const std::string &oid, const std::string &client_id, const Settings &settings); - ~JournalMetadata(); + ~JournalMetadata() override; void init(Context *on_init); void shut_down(Context *on_finish); @@ -180,11 +180,11 @@ private: C_WatchCtx(JournalMetadata *_journal_metadata) : journal_metadata(_journal_metadata) {} - virtual void handle_notify(uint64_t notify_id, uint64_t cookie, - uint64_t notifier_id, bufferlist& bl) { + void handle_notify(uint64_t notify_id, uint64_t cookie, + uint64_t notifier_id, bufferlist& bl) override { journal_metadata->handle_watch_notify(notify_id, cookie); } - virtual void handle_error(uint64_t cookie, int err) { + void handle_error(uint64_t cookie, int err) override { journal_metadata->handle_watch_error(err); } }; @@ -196,10 +196,10 @@ private: : journal_metadata(_journal_metadata) { journal_metadata->m_async_op_tracker.start_op(); } - virtual ~C_WatchReset() { + ~C_WatchReset() override { journal_metadata->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { journal_metadata->handle_watch_reset(); } }; @@ -211,10 +211,10 @@ private: : journal_metadata(_journal_metadata) { journal_metadata->m_async_op_tracker.start_op(); } - virtual ~C_CommitPositionTask() { + ~C_CommitPositionTask() override { journal_metadata->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { Mutex::Locker locker(journal_metadata->m_lock); journal_metadata->handle_commit_position_task(); }; @@ -228,10 +228,10 @@ private: : journal_metadata(_journal_metadata), on_safe(_on_safe) { journal_metadata->m_async_op_tracker.start_op(); } - virtual ~C_AioNotify() { + ~C_AioNotify() override { journal_metadata->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { journal_metadata->handle_notified(r); if (on_safe != nullptr) { on_safe->complete(0); @@ -247,10 +247,10 @@ private: : journal_metadata(_journal_metadata), on_safe(_on_safe) { journal_metadata->m_async_op_tracker.start_op(); } - virtual ~C_NotifyUpdate() { + ~C_NotifyUpdate() override { journal_metadata->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { if (r == 0) { journal_metadata->async_notify_update(on_safe); return; @@ -270,10 +270,10 @@ private: Mutex::Locker locker(journal_metadata->m_lock); journal_metadata->m_async_op_tracker.start_op(); } - virtual ~C_ImmutableMetadata() { + ~C_ImmutableMetadata() override { journal_metadata->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { journal_metadata->handle_immutable_metadata(r, on_finish); } }; @@ -291,10 +291,10 @@ private: Mutex::Locker locker(journal_metadata->m_lock); journal_metadata->m_async_op_tracker.start_op(); } - virtual ~C_Refresh() { + ~C_Refresh() override { journal_metadata->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { journal_metadata->handle_refresh_complete(this, r); } }; diff --git a/src/journal/JournalPlayer.cc b/src/journal/JournalPlayer.cc index b313820c4a83..73c672b31757 100644 --- a/src/journal/JournalPlayer.cc +++ b/src/journal/JournalPlayer.cc @@ -21,7 +21,7 @@ struct C_HandleComplete : public Context { : replay_handler(_replay_handler) { replay_handler->get(); } - ~C_HandleComplete() { + ~C_HandleComplete() override { replay_handler->put(); } void finish(int r) override { @@ -36,7 +36,7 @@ struct C_HandleEntriesAvailable : public Context { : replay_handler(_replay_handler) { replay_handler->get(); } - ~C_HandleEntriesAvailable() { + ~C_HandleEntriesAvailable() override { replay_handler->put(); } void finish(int r) override { diff --git a/src/journal/JournalPlayer.h b/src/journal/JournalPlayer.h index ff5732bd8aa7..f46f17a8ebc5 100644 --- a/src/journal/JournalPlayer.h +++ b/src/journal/JournalPlayer.h @@ -65,10 +65,10 @@ private: C_Fetch(JournalPlayer *p, uint64_t o) : player(p), object_num(o) { player->m_async_op_tracker.start_op(); } - virtual ~C_Fetch() { + ~C_Fetch() override { player->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { player->handle_fetched(object_num, r); } }; @@ -80,11 +80,11 @@ private: : player(player), object_num(object_num) { player->m_async_op_tracker.start_op(); } - virtual ~C_Watch() { + ~C_Watch() override { player->m_async_op_tracker.finish_op(); } - virtual void finish(int r) override { + void finish(int r) override { player->handle_watch(object_num, r); } }; diff --git a/src/journal/JournalRecorder.h b/src/journal/JournalRecorder.h index 7a4af52ee83a..e27a4ee8f30b 100644 --- a/src/journal/JournalRecorder.h +++ b/src/journal/JournalRecorder.h @@ -42,7 +42,7 @@ private: Listener(JournalRecorder *_journal_recorder) : journal_recorder(_journal_recorder) {} - virtual void handle_update(JournalMetadata *) { + void handle_update(JournalMetadata *) override { journal_recorder->handle_update(); } }; @@ -54,10 +54,10 @@ private: : journal_recorder(_journal_recorder) { } - virtual void closed(ObjectRecorder *object_recorder) { + void closed(ObjectRecorder *object_recorder) override { journal_recorder->handle_closed(object_recorder); } - virtual void overflow(ObjectRecorder *object_recorder) { + void overflow(ObjectRecorder *object_recorder) override { journal_recorder->handle_overflow(object_recorder); } }; @@ -68,7 +68,7 @@ private: C_AdvanceObjectSet(JournalRecorder *_journal_recorder) : journal_recorder(_journal_recorder) { } - virtual void finish(int r) { + void finish(int r) override { journal_recorder->handle_advance_object_set(r); } }; diff --git a/src/journal/JournalTrimmer.h b/src/journal/JournalTrimmer.h index 4cda12e5704d..0b27923992d0 100644 --- a/src/journal/JournalTrimmer.h +++ b/src/journal/JournalTrimmer.h @@ -39,7 +39,7 @@ private: MetadataListener(JournalTrimmer *journal_trimmer) : journal_trimmer(journal_trimmer) { } - void handle_update(JournalMetadata *) { + void handle_update(JournalMetadata *) override { journal_trimmer->handle_metadata_updated(); } }; @@ -51,11 +51,11 @@ private: : journal_trimmer(_journal_trimmer) { journal_trimmer->m_async_op_tracker.start_op(); } - virtual ~C_CommitPositionSafe() { + ~C_CommitPositionSafe() override { journal_trimmer->m_async_op_tracker.finish_op(); } - virtual void finish(int r) { + void finish(int r) override { } }; diff --git a/src/journal/Journaler.h b/src/journal/Journaler.h index a14ea344d4ad..bd3529d06a75 100644 --- a/src/journal/Journaler.h +++ b/src/journal/Journaler.h @@ -123,7 +123,7 @@ private: C_InitJournaler(Journaler *_journaler, Context *_on_safe) : journaler(_journaler), on_safe(_on_safe) { } - virtual void finish(int r) { + void finish(int r) override { if (r == 0) { r = journaler->init_complete(); } diff --git a/src/journal/ObjectPlayer.h b/src/journal/ObjectPlayer.h index cff33dc3bcd9..3d495ba7ff7a 100644 --- a/src/journal/ObjectPlayer.h +++ b/src/journal/ObjectPlayer.h @@ -39,7 +39,7 @@ public: ObjectPlayer(librados::IoCtx &ioctx, const std::string &object_oid_prefix, uint64_t object_num, SafeTimer &timer, Mutex &timer_lock, uint8_t order, uint64_t max_fetch_bytes); - ~ObjectPlayer(); + ~ObjectPlayer() override; inline const std::string &get_oid() const { return m_oid; @@ -88,19 +88,19 @@ private: bufferlist read_bl; C_Fetch(ObjectPlayer *o, Context *ctx) : object_player(o), on_finish(ctx) { } - virtual void finish(int r); + void finish(int r) override; }; struct C_WatchTask : public Context { ObjectPlayerPtr object_player; C_WatchTask(ObjectPlayer *o) : object_player(o) { } - virtual void finish(int r); + void finish(int r) override; }; struct C_WatchFetch : public Context { ObjectPlayerPtr object_player; C_WatchFetch(ObjectPlayer *o) : object_player(o) { } - virtual void finish(int r); + void finish(int r) override; }; librados::IoCtx m_ioctx; diff --git a/src/journal/ObjectRecorder.h b/src/journal/ObjectRecorder.h index 67380e43ae12..aad46690134e 100644 --- a/src/journal/ObjectRecorder.h +++ b/src/journal/ObjectRecorder.h @@ -42,7 +42,7 @@ public: ContextWQ *work_queue, SafeTimer &timer, Mutex &timer_lock, Handler *handler, uint8_t order, uint32_t flush_interval, uint64_t flush_bytes, double flush_age); - ~ObjectRecorder(); + ~ObjectRecorder() override; inline uint64_t get_object_number() const { return m_object_number; @@ -79,13 +79,13 @@ private: struct FlushHandler : public FutureImpl::FlushHandler { ObjectRecorder *object_recorder; FlushHandler(ObjectRecorder *o) : object_recorder(o) {} - virtual void get() { + void get() override { object_recorder->get(); } - virtual void put() { + void put() override { object_recorder->put(); } - virtual void flush(const FutureImplPtr &future) { + void flush(const FutureImplPtr &future) override { Mutex::Locker locker(*(object_recorder->m_lock)); object_recorder->flush(future); } @@ -94,7 +94,7 @@ private: ObjectRecorder *object_recorder; C_AppendTask(ObjectRecorder *o) : object_recorder(o) { } - virtual void finish(int r) { + void finish(int r) override { object_recorder->handle_append_task(); } }; @@ -105,7 +105,7 @@ private: : object_recorder(o), tid(_tid) { object_recorder->get(); } - virtual void finish(int r) { + void finish(int r) override { object_recorder->handle_append_flushed(tid, r); object_recorder->put(); } diff --git a/src/journal/Utils.h b/src/journal/Utils.h index b0cee75ae828..c5695e58353f 100644 --- a/src/journal/Utils.h +++ b/src/journal/Utils.h @@ -22,7 +22,7 @@ struct C_AsyncCallback : public Context { C_AsyncCallback(M journal_metadata, Context *on_finish) : journal_metadata(journal_metadata), on_finish(on_finish) { } - virtual void finish(int r) { + void finish(int r) override { journal_metadata->queue(on_finish, r); } }; diff --git a/src/key_value_store/kv_flat_btree_async.h b/src/key_value_store/kv_flat_btree_async.h index 727afe487d13..f16ba6d9a99e 100644 --- a/src/key_value_store/kv_flat_btree_async.h +++ b/src/key_value_store/kv_flat_btree_async.h @@ -749,15 +749,15 @@ public: /** * returns 0 */ - int nothing(); + int nothing() override; /** * 10% chance of waiting wait_ms seconds */ - int wait(); + int wait() override; /** * 10% chance of killing the client. */ - int suicide(); + int suicide() override; KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, bool verb) @@ -815,18 +815,18 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * If inject is wait and wait_time is set, wait will have a 10% chance of * sleeping for waite_time miliseconds. */ - void set_inject(injection_t inject, int wait_time); + void set_inject(injection_t inject, int wait_time) override; /** * sets up the rados and io_ctx of this KvFlatBtreeAsync. If the don't already * exist, creates the index and max object. */ - int setup(int argc, const char** argv); + int setup(int argc, const char** argv) override; int set(const string &key, const bufferlist &val, - bool update_on_existing); + bool update_on_existing) override; - int remove(const string &key); + int remove(const string &key) override; /** * returns true if all of the following are true: @@ -840,23 +840,23 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * * @pre: no operations are in progress */ - bool is_consistent(); + bool is_consistent() override; /** * returns an ASCII representation of the index and sub objects, showing * stats about each object and all omaps. Don't use if you have more than * about 10 objects. */ - string str(); + string str() override; - int get(const string &key, bufferlist *val); + int get(const string &key, bufferlist *val) override; //async versions of these methods void aio_get(const string &key, bufferlist *val, callback cb, - void *cb_args, int * err); + void *cb_args, int * err) override; void aio_set(const string &key, const bufferlist &val, bool exclusive, - callback cb, void * cb_args, int * err); - void aio_remove(const string &key, callback cb, void *cb_args, int * err); + callback cb, void * cb_args, int * err) override; + void aio_remove(const string &key, callback cb, void *cb_args, int * err) override; //these methods that deal with multiple keys at once are efficient, but make //no guarantees about atomicity! @@ -866,7 +866,7 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * attempt to do this safely - make sure this is the only operation running * when it is called! */ - int remove_all(); + int remove_all() override; /** * This does not add prefixes to the index and therefore DOES NOT guarantee @@ -890,10 +890,10 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * * The keys are distributed across the range of keys in the store * * there is a small number of keys compared to k */ - int set_many(const map &in_map); + int set_many(const map &in_map) override; - int get_all_keys(std::set *keys); - int get_all_keys_and_values(map *kv_map); + int get_all_keys(std::set *keys) override; + int get_all_keys_and_values(map *kv_map) override; }; diff --git a/src/kv/KeyValueDB.h b/src/kv/KeyValueDB.h index d56ac819552a..52d434e2bd38 100644 --- a/src/kv/KeyValueDB.h +++ b/src/kv/KeyValueDB.h @@ -226,28 +226,28 @@ public: public: IteratorImpl(const std::string &prefix, WholeSpaceIterator iter) : prefix(prefix), generic_iter(iter) { } - virtual ~IteratorImpl() { } + ~IteratorImpl() override { } - int seek_to_first() { + int seek_to_first() override { return generic_iter->seek_to_first(prefix); } int seek_to_last() { return generic_iter->seek_to_last(prefix); } - int upper_bound(const std::string &after) { + int upper_bound(const std::string &after) override { return generic_iter->upper_bound(prefix, after); } - int lower_bound(const std::string &to) { + int lower_bound(const std::string &to) override { return generic_iter->lower_bound(prefix, to); } - bool valid() { + bool valid() override { if (!generic_iter->valid()) 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) { + int next(bool validate=true) override { if (validate) { if (valid()) return generic_iter->next(); @@ -266,19 +266,19 @@ public: return generic_iter->prev(); } } - std::string key() { + std::string key() override { return generic_iter->key(); } std::pair raw_key() { return generic_iter->raw_key(); } - bufferlist value() { + bufferlist value() override { return generic_iter->value(); } bufferptr value_as_ptr() { return generic_iter->value_as_ptr(); } - int status() { + int status() override { return generic_iter->status(); } }; diff --git a/src/kv/LevelDBStore.cc b/src/kv/LevelDBStore.cc index a1895b639f4e..b9951e15dd8b 100644 --- a/src/kv/LevelDBStore.cc +++ b/src/kv/LevelDBStore.cc @@ -22,7 +22,7 @@ public: explicit CephLevelDBLogger(CephContext *c) : cct(c) { cct->get(); } - ~CephLevelDBLogger() { + ~CephLevelDBLogger() override { cct->put(); } diff --git a/src/kv/LevelDBStore.h b/src/kv/LevelDBStore.h index ce55bf41bbe0..c4abbf63b3fc 100644 --- a/src/kv/LevelDBStore.h +++ b/src/kv/LevelDBStore.h @@ -74,7 +74,7 @@ class LevelDBStore : public KeyValueDB { LevelDBStore *db; public: explicit CompactThread(LevelDBStore *d) : db(d) {} - void *entry() { + void *entry() override { db->compact_thread_entry(); return NULL; } @@ -92,21 +92,21 @@ class LevelDBStore : public KeyValueDB { public: /// compact the underlying leveldb store - void compact(); + void compact() override; /// compact db for all keys with a given prefix - void compact_prefix(const string& prefix) { + void compact_prefix(const string& prefix) override { compact_range(prefix, past_prefix(prefix)); } - void compact_prefix_async(const string& prefix) { + void compact_prefix_async(const string& prefix) override { compact_range_async(prefix, past_prefix(prefix)); } void compact_range(const string& prefix, - const string& start, const string& end) { + const string& start, const string& end) override { compact_range(combine_strings(prefix, start), combine_strings(prefix, end)); } void compact_range_async(const string& prefix, - const string& start, const string& end) { + const string& start, const string& end) override { compact_range_async(combine_strings(prefix, start), combine_strings(prefix, end)); } @@ -165,21 +165,21 @@ public: options() {} - ~LevelDBStore(); + ~LevelDBStore() override; static int _test_init(const string& dir); - int init(string option_str=""); + int init(string option_str="") override; /// Opens underlying db - int open(ostream &out) { + int open(ostream &out) override { return do_open(out, false); } /// Creates underlying db if missing and opens it - int create_and_open(ostream &out) { + int create_and_open(ostream &out) override { return do_open(out, true); } - void close(); + void close() override; class LevelDBTransactionImpl : public KeyValueDB::TransactionImpl { public: @@ -189,32 +189,32 @@ public: void set( const string &prefix, const string &k, - const bufferlist &bl); + const bufferlist &bl) override; using KeyValueDB::TransactionImpl::set; void rmkey( const string &prefix, - const string &k); + const string &k) override; void rmkeys_by_prefix( const string &prefix - ); + ) override; using KeyValueDB::TransactionImpl::rmkey; }; - KeyValueDB::Transaction get_transaction() { + KeyValueDB::Transaction get_transaction() override { return std::make_shared(this); } - int submit_transaction(KeyValueDB::Transaction t); - int submit_transaction_sync(KeyValueDB::Transaction t); + int submit_transaction(KeyValueDB::Transaction t) override; + int submit_transaction_sync(KeyValueDB::Transaction t) override; int get( const string &prefix, const std::set &key, std::map *out - ); + ) override; int get(const string &prefix, const string &key, - bufferlist *value); + bufferlist *value) override; using KeyValueDB::get; @@ -225,22 +225,22 @@ public: public: explicit LevelDBWholeSpaceIteratorImpl(leveldb::Iterator *iter) : dbiter(iter) { } - virtual ~LevelDBWholeSpaceIteratorImpl() { } + ~LevelDBWholeSpaceIteratorImpl() override { } - int seek_to_first() { + int seek_to_first() override { dbiter->SeekToFirst(); return dbiter->status().ok() ? 0 : -1; } - int seek_to_first(const string &prefix) { + int seek_to_first(const string &prefix) override { leveldb::Slice slice_prefix(prefix); dbiter->Seek(slice_prefix); return dbiter->status().ok() ? 0 : -1; } - int seek_to_last() { + int seek_to_last() override { dbiter->SeekToLast(); return dbiter->status().ok() ? 0 : -1; } - int seek_to_last(const string &prefix) { + int seek_to_last(const string &prefix) override { string limit = past_prefix(prefix); leveldb::Slice slice_limit(limit); dbiter->Seek(slice_limit); @@ -252,7 +252,7 @@ public: } return dbiter->status().ok() ? 0 : -1; } - int upper_bound(const string &prefix, const string &after) { + int upper_bound(const string &prefix, const string &after) override { lower_bound(prefix, after); if (valid()) { pair key = raw_key(); @@ -261,36 +261,36 @@ public: } return dbiter->status().ok() ? 0 : -1; } - int lower_bound(const string &prefix, const string &to) { + int lower_bound(const string &prefix, const string &to) override { string bound = combine_strings(prefix, to); leveldb::Slice slice_bound(bound); dbiter->Seek(slice_bound); return dbiter->status().ok() ? 0 : -1; } - bool valid() { + bool valid() override { return dbiter->Valid(); } - int next() { + int next() override { if (valid()) dbiter->Next(); return dbiter->status().ok() ? 0 : -1; } - int prev() { + int prev() override { if (valid()) dbiter->Prev(); return dbiter->status().ok() ? 0 : -1; } - string key() { + string key() override { string out_key; split_key(dbiter->key(), 0, &out_key); return out_key; } - pair raw_key() { + pair raw_key() override { string prefix, key; split_key(dbiter->key(), &prefix, &key); return make_pair(prefix, key); } - bool raw_key_is_prefixed(const string &prefix) { + bool raw_key_is_prefixed(const string &prefix) override { leveldb::Slice key = dbiter->key(); if ((key.size() > prefix.length()) && (key[prefix.length()] == '\0')) { return memcmp(key.data(), prefix.c_str(), prefix.length()) == 0; @@ -298,16 +298,16 @@ public: return false; } } - bufferlist value() { + bufferlist value() override { return to_bufferlist(dbiter->value()); } - bufferptr value_as_ptr() { + bufferptr value_as_ptr() override { leveldb::Slice data = dbiter->value(); return bufferptr(data.data(), data.size()); } - int status() { + int status() override { return dbiter->status().ok() ? 0 : -1; } }; @@ -322,7 +322,7 @@ public: return limit; } - virtual uint64_t get_estimated_size(map &extra) { + uint64_t get_estimated_size(map &extra) override { DIR *store_dir = opendir(path.c_str()); if (!store_dir) { lderr(cct) << __func__ << " something happened opening the store: " @@ -390,7 +390,7 @@ err: protected: - WholeSpaceIterator _get_iterator() { + WholeSpaceIterator _get_iterator() override { return std::make_shared( db->NewIterator(leveldb::ReadOptions())); } diff --git a/src/kv/MemDB.h b/src/kv/MemDB.h index 565b94a7fa61..d3c8268cc43c 100644 --- a/src/kv/MemDB.h +++ b/src/kv/MemDB.h @@ -46,7 +46,7 @@ class MemDB : public KeyValueDB int transaction_rollback(KeyValueDB::Transaction t); int _open(ostream &out); - void close(); + void close() override; bool _get(const string &prefix, const string &k, bufferlist *out); bool _get_locked(const string &prefix, const string &k, bufferlist *out); std::string _get_data_fn(); @@ -62,9 +62,9 @@ public: //Nothing as of now } - ~MemDB(); - virtual int set_merge_operator(const std::string& prefix, - std::shared_ptr mop); + ~MemDB() override; + int set_merge_operator(const std::string& prefix, + std::shared_ptr mop) override; std::shared_ptr _find_merge_op(std::string prefix); @@ -85,13 +85,13 @@ public: get_ops() { return ops; }; void set(const std::string &prefix, const std::string &key, - const bufferlist &val); + const bufferlist &val) override; using KeyValueDB::TransactionImpl::set; - void rmkey(const std::string &prefix, const std::string &k); + void rmkey(const std::string &prefix, const std::string &k) override; using KeyValueDB::TransactionImpl::rmkey; - void rmkeys_by_prefix(const std::string &prefix); + void rmkeys_by_prefix(const std::string &prefix) override; - void merge(const std::string &prefix, const std::string &key, const bufferlist &value); + void merge(const std::string &prefix, const std::string &key, const bufferlist &value) override; void clear() { ops.clear(); } @@ -99,7 +99,7 @@ public: { ops.clear(); } - ~MDBTransactionImpl() {}; + ~MDBTransactionImpl() override {}; }; private: @@ -114,19 +114,19 @@ private: public: - int init(string option_str="") { m_options = option_str; return 0; } + int init(string option_str="") override { m_options = option_str; return 0; } int _init(bool format); int do_open(ostream &out, bool create); - int open(ostream &out) { return do_open(out, false); } - int create_and_open(ostream &out) { return do_open(out, true); } + int open(ostream &out) override { return do_open(out, false); } + int create_and_open(ostream &out) override { return do_open(out, true); } - KeyValueDB::Transaction get_transaction() { + KeyValueDB::Transaction get_transaction() override { return std::shared_ptr(new MDBTransactionImpl(this)); } - int submit_transaction(Transaction); - int submit_transaction_sync(Transaction); + int submit_transaction(Transaction) override; + int submit_transaction_sync(Transaction) override; int get(const std::string &prefix, const std::set &key, std::map *out) override; @@ -161,34 +161,34 @@ public: void free_last(); - int seek_to_first(const std::string &k); - int seek_to_last(const std::string &k); + int seek_to_first(const std::string &k) override; + int seek_to_last(const std::string &k) override; - int seek_to_first() { return seek_to_first(std::string()); }; - int seek_to_last() { return seek_to_last(std::string()); }; + int seek_to_first() override { return seek_to_first(std::string()); }; + int seek_to_last() override { return seek_to_last(std::string()); }; - int upper_bound(const std::string &prefix, const std::string &after); - int lower_bound(const std::string &prefix, const std::string &to); - bool valid(); + int upper_bound(const std::string &prefix, const std::string &after) override; + int lower_bound(const std::string &prefix, const std::string &to) override; + bool valid() override; bool iterator_validate(); - int next(); - int prev(); - int status() { return 0; }; + int next() override; + int prev() override; + int status() override { return 0; }; - std::string key(); - std::pair raw_key(); - bool raw_key_is_prefixed(const std::string &prefix); - bufferlist value(); - ~MDBWholeSpaceIteratorImpl(); + std::string key() override; + std::pair raw_key() override; + bool raw_key_is_prefixed(const std::string &prefix) override; + bufferlist value() override; + ~MDBWholeSpaceIteratorImpl() override; }; - uint64_t get_estimated_size(std::map &extra) { + uint64_t get_estimated_size(std::map &extra) override { std::lock_guard l(m_lock); return m_allocated_bytes; }; - int get_statfs(struct store_statfs_t *buf) { + int get_statfs(struct store_statfs_t *buf) override { std::lock_guard l(m_lock); buf->reset(); buf->total = m_total_bytes; @@ -199,7 +199,7 @@ public: protected: - WholeSpaceIterator _get_iterator() { + WholeSpaceIterator _get_iterator() override { return std::shared_ptr( new MDBWholeSpaceIteratorImpl(&m_map, &m_lock, &iterator_seq_no, m_using_btree)); } diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 29f9d0f1e145..3fcc14a209cd 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -100,7 +100,7 @@ public: explicit CephRocksdbLogger(CephContext *c) : cct(c) { cct->get(); } - ~CephRocksdbLogger() { + ~CephRocksdbLogger() override { cct->put(); } diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h index 7c0d59035046..0d15ca4818b9 100644 --- a/src/kv/RocksDBStore.h +++ b/src/kv/RocksDBStore.h @@ -86,7 +86,7 @@ class RocksDBStore : public KeyValueDB { RocksDBStore *db; public: explicit CompactThread(RocksDBStore *d) : db(d) {} - void *entry() { + void *entry() override { db->compact_thread_entry(); return NULL; } @@ -102,24 +102,24 @@ public: /// compact the underlying rocksdb store bool compact_on_mount; bool disableWAL; - void compact(); + void compact() override; int tryInterpret(const string key, const string val, rocksdb::Options &opt); int ParseOptionsFromString(const string opt_str, rocksdb::Options &opt); static int _test_init(const string& dir); - int init(string options_str); + int init(string options_str) override; /// compact rocksdb for all keys with a given prefix - void compact_prefix(const string& prefix) { + void compact_prefix(const string& prefix) override { compact_range(prefix, past_prefix(prefix)); } - void compact_prefix_async(const string& prefix) { + void compact_prefix_async(const string& prefix) override { compact_range_async(prefix, past_prefix(prefix)); } - void compact_range(const string& prefix, const string& start, const string& end) { + void compact_range(const string& prefix, const string& start, const string& end) override { compact_range(combine_strings(prefix, start), combine_strings(prefix, end)); } - void compact_range_async(const string& prefix, const string& start, const string& end) { + void compact_range_async(const string& prefix, const string& start, const string& end) override { compact_range_async(combine_strings(prefix, start), combine_strings(prefix, end)); } @@ -138,20 +138,20 @@ public: disableWAL(false) {} - ~RocksDBStore(); + ~RocksDBStore() override; static bool check_omap_dir(string &omap_dir); /// Opens underlying db - int open(ostream &out) { + int open(ostream &out) override { return do_open(out, false); } /// Creates underlying db if missing and opens it - int create_and_open(ostream &out); + int create_and_open(ostream &out) override; - void close(); + void close() override; void split_stats(const std::string &s, char delim, std::vector &elems); - void get_statistics(Formatter *f); + void get_statistics(Formatter *f) override; struct RocksWBHandler: public rocksdb::WriteBatch::Handler { std::string seen ; @@ -204,7 +204,7 @@ public: } return out; } - virtual void Put(const rocksdb::Slice& key, + void Put(const rocksdb::Slice& key, const rocksdb::Slice& value) override { string prefix ((key.ToString()).substr(0,1)); string key_to_decode ((key.ToString()).substr(2,string::npos)); @@ -214,14 +214,14 @@ public: + " Value size = " + std::to_string(size) + ")"; num_seen++; } - virtual void SingleDelete(const rocksdb::Slice& key) override { + void SingleDelete(const rocksdb::Slice& key) override { string prefix ((key.ToString()).substr(0,1)); string key_to_decode ((key.ToString()).substr(2,string::npos)); seen += "\nSingleDelete(Prefix = "+ prefix + " Key = " + pretty_binary_string(key_to_decode) + ")"; num_seen++; } - virtual void Delete(const rocksdb::Slice& key) override { + void Delete(const rocksdb::Slice& key) override { string prefix ((key.ToString()).substr(0,1)); string key_to_decode ((key.ToString()).substr(2,string::npos)); seen += "\nDelete( Prefix = " + prefix + " key = " @@ -229,7 +229,7 @@ public: num_seen++; } - virtual void Merge(const rocksdb::Slice& key, + void Merge(const rocksdb::Slice& key, const rocksdb::Slice& value) override { string prefix ((key.ToString()).substr(0,1)); string key_to_decode ((key.ToString()).substr(2,string::npos)); @@ -240,7 +240,7 @@ public: num_seen++; } - virtual bool Continue() override { return num_seen < 50; } + bool Continue() override { return num_seen < 50; } }; @@ -279,12 +279,12 @@ public: const bufferlist &bl) override; }; - KeyValueDB::Transaction get_transaction() { + KeyValueDB::Transaction get_transaction() override { return std::make_shared(this); } - int submit_transaction(KeyValueDB::Transaction t); - int submit_transaction_sync(KeyValueDB::Transaction t); + int submit_transaction(KeyValueDB::Transaction t) override; + int submit_transaction_sync(KeyValueDB::Transaction t) override; int get( const string &prefix, const std::set &key, @@ -310,23 +310,23 @@ public: explicit RocksDBWholeSpaceIteratorImpl(rocksdb::Iterator *iter) : dbiter(iter) { } //virtual ~RocksDBWholeSpaceIteratorImpl() { } - ~RocksDBWholeSpaceIteratorImpl(); - - int seek_to_first(); - int seek_to_first(const string &prefix); - int seek_to_last(); - int seek_to_last(const string &prefix); - int upper_bound(const string &prefix, const string &after); - int lower_bound(const string &prefix, const string &to); - bool valid(); - int next(); - int prev(); - string key(); - pair raw_key(); - bool raw_key_is_prefixed(const string &prefix); - bufferlist value(); - bufferptr value_as_ptr(); - int status(); + ~RocksDBWholeSpaceIteratorImpl() override; + + int seek_to_first() override; + int seek_to_first(const string &prefix) override; + int seek_to_last() override; + int seek_to_last(const string &prefix) override; + int upper_bound(const string &prefix, const string &after) override; + int lower_bound(const string &prefix, const string &to) override; + bool valid() override; + int next() override; + int prev() override; + string key() override; + pair raw_key() override; + bool raw_key_is_prefixed(const string &prefix) override; + bufferlist value() override; + bufferptr value_as_ptr() override; + int status() override; size_t key_size() override; size_t value_size() override; }; @@ -359,11 +359,11 @@ public: class MergeOperatorRouter; friend class MergeOperatorRouter; - virtual int set_merge_operator(const std::string& prefix, - std::shared_ptr mop); + int set_merge_operator(const std::string& prefix, + std::shared_ptr mop) override; string assoc_name; ///< Name of associative operator - virtual uint64_t get_estimated_size(map &extra) { + uint64_t get_estimated_size(map &extra) override { DIR *store_dir = opendir(path.c_str()); if (!store_dir) { lderr(cct) << __func__ << " something happened opening the store: " @@ -431,7 +431,7 @@ err: protected: - WholeSpaceIterator _get_iterator(); + WholeSpaceIterator _get_iterator() override; }; diff --git a/src/log/Log.h b/src/log/Log.h index a8ef1c8a6970..ce77daabc41f 100644 --- a/src/log/Log.h +++ b/src/log/Log.h @@ -51,7 +51,7 @@ class Log : private Thread bool m_inject_segv; - void *entry(); + void *entry() override; void _flush(EntryQueue *q, EntryQueue *requeue, bool crash); @@ -59,7 +59,7 @@ class Log : private Thread public: explicit Log(SubsystemMap *s); - virtual ~Log(); + ~Log() override; void set_flush_on_exit();