diff options
author | Patrick Donnelly <pdonnell@redhat.com> | 2018-07-31 22:59:52 +0200 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2018-08-15 22:36:38 +0200 |
commit | e0d3db89043e6a595cd10a883532e8d9195e36ca (patch) | |
tree | 75878dab9893fb64c488265ada39e106d0396893 | |
parent | mds: use message factory to avoid leaks (diff) | |
download | ceph-e0d3db89043e6a595cd10a883532e8d9195e36ca.tar.xz ceph-e0d3db89043e6a595cd10a883532e8d9195e36ca.zip |
msg: cleanup factory/ref definition in messages
This eliminates duplicate code definitions.
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
152 files changed, 458 insertions, 900 deletions
diff --git a/src/messages/MAuth.h b/src/messages/MAuth.h index 96397fd7a3f..759a66ddcce 100644 --- a/src/messages/MAuth.h +++ b/src/messages/MAuth.h @@ -17,11 +17,8 @@ #include "messages/PaxosServiceMessage.h" -class MAuth : public PaxosServiceMessage { +class MAuth : public MessageInstance<MAuth, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MAuth> ref; - typedef boost::intrusive_ptr<MAuth const> const_ref; - using factory = MessageFactory<MAuth>; friend factory; __u32 protocol; @@ -30,7 +27,7 @@ public: /* if protocol == 0, then auth_payload is a set<__u32> listing protocols the client supports */ - MAuth() : PaxosServiceMessage(CEPH_MSG_AUTH, 0), protocol(0), monmap_epoch(0) { } + MAuth() : MessageInstance(CEPH_MSG_AUTH, 0), protocol(0), monmap_epoch(0) { } private: ~MAuth() override {} diff --git a/src/messages/MAuthReply.h b/src/messages/MAuthReply.h index 5fe8869adaf..4a4b509cc8d 100644 --- a/src/messages/MAuthReply.h +++ b/src/messages/MAuthReply.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "common/errno.h" -class MAuthReply : public Message { +class MAuthReply : public MessageInstance<MAuthReply> { public: - typedef boost::intrusive_ptr<MAuthReply> ref; - typedef boost::intrusive_ptr<MAuthReply const> const_ref; - using factory = MessageFactory<MAuthReply>; friend factory; __u32 protocol; @@ -31,9 +28,9 @@ public: string result_msg; bufferlist result_bl; - MAuthReply() : Message(CEPH_MSG_AUTH_REPLY), protocol(0), result(0), global_id(0) {} + MAuthReply() : MessageInstance(CEPH_MSG_AUTH_REPLY), protocol(0), result(0), global_id(0) {} MAuthReply(__u32 p, bufferlist *bl = NULL, int r = 0, uint64_t gid=0, const char *msg = "") : - Message(CEPH_MSG_AUTH_REPLY), + MessageInstance(CEPH_MSG_AUTH_REPLY), protocol(p), result(r), global_id(gid), result_msg(msg) { if (bl) diff --git a/src/messages/MBackfillReserve.h b/src/messages/MBackfillReserve.h index 3d11aac9e28..b8d64f825e3 100644 --- a/src/messages/MBackfillReserve.h +++ b/src/messages/MBackfillReserve.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "messages/MOSDPeeringOp.h" -class MBackfillReserve : public MOSDPeeringOp { +class MBackfillReserve : public MessageInstance<MBackfillReserve, MOSDPeeringOp> { public: - typedef boost::intrusive_ptr<MBackfillReserve> ref; - typedef boost::intrusive_ptr<MBackfillReserve const> const_ref; - using factory = MessageFactory<MBackfillReserve>; friend factory; private: static const int HEAD_VERSION = 4; @@ -95,12 +92,12 @@ public: } MBackfillReserve() - : MOSDPeeringOp(MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION), query_epoch(0), type(-1), priority(-1) {} MBackfillReserve(int type, spg_t pgid, epoch_t query_epoch, unsigned prio = -1) - : MOSDPeeringOp(MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_BACKFILL_RESERVE, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), query_epoch(query_epoch), type(type), priority(prio) {} diff --git a/src/messages/MCacheExpire.h b/src/messages/MCacheExpire.h index 1fd699b8ef4..07153fcf024 100644 --- a/src/messages/MCacheExpire.h +++ b/src/messages/MCacheExpire.h @@ -21,11 +21,8 @@ #include "mds/mdstypes.h" -class MCacheExpire : public Message { +class MCacheExpire : public MessageInstance<MCacheExpire> { public: - typedef boost::intrusive_ptr<MCacheExpire> ref; - typedef boost::intrusive_ptr<MCacheExpire const> const_ref; - using factory = MessageFactory<MCacheExpire>; friend factory; private: __s32 from; @@ -71,9 +68,9 @@ public: int get_from() const { return from; } protected: - MCacheExpire() : Message(MSG_MDS_CACHEEXPIRE), from(-1) {} + MCacheExpire() : MessageInstance(MSG_MDS_CACHEEXPIRE), from(-1) {} MCacheExpire(int f) : - Message(MSG_MDS_CACHEEXPIRE), + MessageInstance(MSG_MDS_CACHEEXPIRE), from(f) { } ~MCacheExpire() override {} diff --git a/src/messages/MClientCapRelease.h b/src/messages/MClientCapRelease.h index 1cd8b87819c..8106d621c64 100644 --- a/src/messages/MClientCapRelease.h +++ b/src/messages/MClientCapRelease.h @@ -18,11 +18,8 @@ #include "msg/Message.h" -class MClientCapRelease : public Message { +class MClientCapRelease : public MessageInstance<MClientCapRelease> { public: - typedef boost::intrusive_ptr<MClientCapRelease> ref; - typedef boost::intrusive_ptr<MClientCapRelease const> const_ref; - using factory = MessageFactory<MClientCapRelease>; friend factory; private: @@ -38,7 +35,7 @@ private: epoch_t osd_epoch_barrier; MClientCapRelease() : - Message(CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(CEPH_MSG_CLIENT_CAPRELEASE, HEAD_VERSION, COMPAT_VERSION), osd_epoch_barrier(0) { memset(&head, 0, sizeof(head)); diff --git a/src/messages/MClientCaps.h b/src/messages/MClientCaps.h index 323634261d9..38abc02437b 100644 --- a/src/messages/MClientCaps.h +++ b/src/messages/MClientCaps.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "include/ceph_features.h" -class MClientCaps : public Message { +class MClientCaps : public MessageInstance<MClientCaps> { public: - typedef boost::intrusive_ptr<MClientCaps> ref; - typedef boost::intrusive_ptr<MClientCaps const> const_ref; - using factory = MessageFactory<MClientCaps>; friend factory; private: @@ -133,7 +130,7 @@ private: protected: MClientCaps() - : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION) {} MClientCaps(int op, inodeno_t ino, inodeno_t realm, @@ -144,7 +141,7 @@ protected: int dirty, int mseq, epoch_t oeb) - : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION), osd_epoch_barrier(oeb) { memset(&head, 0, sizeof(head)); head.op = op; @@ -161,7 +158,7 @@ protected: MClientCaps(int op, inodeno_t ino, inodeno_t realm, uint64_t id, int mseq, epoch_t oeb) - : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION), osd_epoch_barrier(oeb) { memset(&head, 0, sizeof(head)); head.op = op; diff --git a/src/messages/MClientLease.h b/src/messages/MClientLease.h index 25237c649ae..663f9c8a6ee 100644 --- a/src/messages/MClientLease.h +++ b/src/messages/MClientLease.h @@ -20,11 +20,8 @@ #include "msg/Message.h" -class MClientLease : public Message { +class MClientLease : public MessageInstance<MClientLease> { public: - typedef boost::intrusive_ptr<MClientLease> ref; - typedef boost::intrusive_ptr<MClientLease const> const_ref; - using factory = MessageFactory<MClientLease>; friend factory; struct ceph_mds_lease h; @@ -38,13 +35,13 @@ public: snapid_t get_last() const { return snapid_t(h.last); } protected: - MClientLease() : Message(CEPH_MSG_CLIENT_LEASE) {} + MClientLease() : MessageInstance(CEPH_MSG_CLIENT_LEASE) {} MClientLease(const MClientLease& m) : - Message(CEPH_MSG_CLIENT_LEASE), + MessageInstance(CEPH_MSG_CLIENT_LEASE), h(m.h), dname(m.dname) {} MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl) : - Message(CEPH_MSG_CLIENT_LEASE) { + MessageInstance(CEPH_MSG_CLIENT_LEASE) { h.action = ac; h.seq = seq; h.mask = m; @@ -54,7 +51,7 @@ protected: h.duration_ms = 0; } MClientLease(int ac, ceph_seq_t seq, int m, uint64_t i, uint64_t sf, uint64_t sl, std::string_view d) : - Message(CEPH_MSG_CLIENT_LEASE), + MessageInstance(CEPH_MSG_CLIENT_LEASE), dname(d) { h.action = ac; h.seq = seq; diff --git a/src/messages/MClientQuota.h b/src/messages/MClientQuota.h index cd58a9ed6f0..bced9f1a033 100644 --- a/src/messages/MClientQuota.h +++ b/src/messages/MClientQuota.h @@ -3,11 +3,8 @@ #include "msg/Message.h" -class MClientQuota : public Message { +class MClientQuota : public MessageInstance<MClientQuota> { public: - typedef boost::intrusive_ptr<MClientQuota> ref; - typedef boost::intrusive_ptr<MClientQuota const> const_ref; - using factory = MessageFactory<MClientQuota>; friend factory; inodeno_t ino; @@ -16,7 +13,7 @@ public: protected: MClientQuota() : - Message(CEPH_MSG_CLIENT_QUOTA), + MessageInstance(CEPH_MSG_CLIENT_QUOTA), ino(0) {} ~MClientQuota() override {} diff --git a/src/messages/MClientReconnect.h b/src/messages/MClientReconnect.h index 42e611131b8..96e9b210e84 100644 --- a/src/messages/MClientReconnect.h +++ b/src/messages/MClientReconnect.h @@ -20,11 +20,8 @@ #include "include/ceph_features.h" -class MClientReconnect : public Message { +class MClientReconnect : public MessageInstance<MClientReconnect> { public: - typedef boost::intrusive_ptr<MClientReconnect> ref; - typedef boost::intrusive_ptr<MClientReconnect const> const_ref; - using factory = MessageFactory<MClientReconnect>; friend factory; private: const static int HEAD_VERSION = 3; @@ -33,7 +30,7 @@ public: map<inodeno_t, cap_reconnect_t> caps; // only head inodes vector<ceph_mds_snaprealm_reconnect> realms; - MClientReconnect() : Message(CEPH_MSG_CLIENT_RECONNECT, HEAD_VERSION) { } + MClientReconnect() : MessageInstance(CEPH_MSG_CLIENT_RECONNECT, HEAD_VERSION) { } private: ~MClientReconnect() override {} diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h index 1a4765521b1..cdcc8a615bf 100644 --- a/src/messages/MClientReply.h +++ b/src/messages/MClientReply.h @@ -253,11 +253,8 @@ struct InodeStat { }; -class MClientReply : public Message { +class MClientReply : public MessageInstance<MClientReply> { public: - typedef boost::intrusive_ptr<MClientReply> ref; - typedef boost::intrusive_ptr<MClientReply const> const_ref; - using factory = MessageFactory<MClientReply>; friend factory; // reply data @@ -282,9 +279,9 @@ public: bool is_safe() const { return head.safe; } protected: - MClientReply() : Message(CEPH_MSG_CLIENT_REPLY) {} + MClientReply() : MessageInstance(CEPH_MSG_CLIENT_REPLY) {} MClientReply(const MClientRequest &req, int result = 0) : - Message(CEPH_MSG_CLIENT_REPLY) { + MessageInstance(CEPH_MSG_CLIENT_REPLY) { memset(&head, 0, sizeof(head)); header.tid = req.get_tid(); head.op = req.get_op(); diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index 12a28dafc1b..f190979a9c5 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -48,11 +48,8 @@ // metadata ops. -class MClientRequest : public Message { +class MClientRequest : public MessageInstance<MClientRequest> { public: - typedef boost::intrusive_ptr<MClientRequest> ref; - typedef boost::intrusive_ptr<MClientRequest const> const_ref; - using factory = MessageFactory<MClientRequest>; friend factory; private: static const int HEAD_VERSION = 4; @@ -94,9 +91,9 @@ public: protected: // cons MClientRequest() - : Message(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) {} MClientRequest(int op) - : Message(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) { + : MessageInstance(CEPH_MSG_CLIENT_REQUEST, HEAD_VERSION, COMPAT_VERSION) { memset(&head, 0, sizeof(head)); head.op = op; } diff --git a/src/messages/MClientRequestForward.h b/src/messages/MClientRequestForward.h index b303a0c765b..31381849171 100644 --- a/src/messages/MClientRequestForward.h +++ b/src/messages/MClientRequestForward.h @@ -18,11 +18,8 @@ #include "msg/Message.h" -class MClientRequestForward : public Message { +class MClientRequestForward : public MessageInstance<MClientRequestForward> { public: - typedef boost::intrusive_ptr<MClientRequestForward> ref; - typedef boost::intrusive_ptr<MClientRequestForward const> const_ref; - using factory = MessageFactory<MClientRequestForward>; friend factory; private: int32_t dest_mds; @@ -31,10 +28,10 @@ private: protected: MClientRequestForward() - : Message(CEPH_MSG_CLIENT_REQUEST_FORWARD), + : MessageInstance(CEPH_MSG_CLIENT_REQUEST_FORWARD), dest_mds(-1), num_fwd(-1), client_must_resend(false) {} MClientRequestForward(ceph_tid_t t, int dm, int nf, bool cmr) : - Message(CEPH_MSG_CLIENT_REQUEST_FORWARD), + MessageInstance(CEPH_MSG_CLIENT_REQUEST_FORWARD), dest_mds(dm), num_fwd(nf), client_must_resend(cmr) { assert(client_must_resend); header.tid = t; diff --git a/src/messages/MClientSession.h b/src/messages/MClientSession.h index 3f2d1b9d193..a672812fc29 100644 --- a/src/messages/MClientSession.h +++ b/src/messages/MClientSession.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "mds/mdstypes.h" -class MClientSession : public Message { +class MClientSession : public MessageInstance<MClientSession> { public: - typedef boost::intrusive_ptr<MClientSession> ref; - typedef boost::intrusive_ptr<MClientSession const> const_ref; - using factory = MessageFactory<MClientSession>; friend factory; private: static const int HEAD_VERSION = 3; @@ -41,15 +38,15 @@ public: int get_max_leases() const { return head.max_leases; } protected: - MClientSession() : Message(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { } + MClientSession() : MessageInstance(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { } MClientSession(int o, version_t s=0) : - Message(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { + MessageInstance(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { memset(&head, 0, sizeof(head)); head.op = o; head.seq = s; } MClientSession(int o, utime_t st) : - Message(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { + MessageInstance(CEPH_MSG_CLIENT_SESSION, HEAD_VERSION, COMPAT_VERSION) { memset(&head, 0, sizeof(head)); head.op = o; head.seq = 0; diff --git a/src/messages/MClientSnap.h b/src/messages/MClientSnap.h index 21649cf9ea8..9c7927576e6 100644 --- a/src/messages/MClientSnap.h +++ b/src/messages/MClientSnap.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MClientSnap : public Message { +class MClientSnap : public MessageInstance<MClientSnap> { public: - typedef boost::intrusive_ptr<MClientSnap> ref; - typedef boost::intrusive_ptr<MClientSnap const> const_ref; - using factory = MessageFactory<MClientSnap>; friend factory; ceph_mds_snap_head head; @@ -33,7 +30,7 @@ public: protected: MClientSnap(int o=0) : - Message(CEPH_MSG_CLIENT_SNAP) { + MessageInstance(CEPH_MSG_CLIENT_SNAP) { memset(&head, 0, sizeof(head)); head.op = o; } diff --git a/src/messages/MCommand.h b/src/messages/MCommand.h index 3f7d73999cf..8a86258489c 100644 --- a/src/messages/MCommand.h +++ b/src/messages/MCommand.h @@ -19,20 +19,17 @@ #include "msg/Message.h" -class MCommand : public Message { +class MCommand : public MessageInstance<MCommand> { public: - typedef boost::intrusive_ptr<MCommand> ref; - typedef boost::intrusive_ptr<MCommand const> const_ref; - using factory = MessageFactory<MCommand>; friend factory; uuid_d fsid; std::vector<string> cmd; MCommand() - : Message(MSG_COMMAND) {} + : MessageInstance(MSG_COMMAND) {} MCommand(const uuid_d &f) - : Message(MSG_COMMAND), + : MessageInstance(MSG_COMMAND), fsid(f) { } private: diff --git a/src/messages/MCommandReply.h b/src/messages/MCommandReply.h index 3390aa8d787..622adfd808e 100644 --- a/src/messages/MCommandReply.h +++ b/src/messages/MCommandReply.h @@ -20,24 +20,21 @@ #include "msg/Message.h" #include "MCommand.h" -class MCommandReply : public Message { +class MCommandReply : public MessageInstance<MCommandReply> { public: - typedef boost::intrusive_ptr<MCommandReply> ref; - typedef boost::intrusive_ptr<MCommandReply const> const_ref; - using factory = MessageFactory<MCommandReply>; friend factory; errorcode32_t r; string rs; MCommandReply() - : Message(MSG_COMMAND_REPLY) {} + : MessageInstance(MSG_COMMAND_REPLY) {} MCommandReply(MCommand *m, int _r) - : Message(MSG_COMMAND_REPLY), r(_r) { + : MessageInstance(MSG_COMMAND_REPLY), r(_r) { header.tid = m->get_tid(); } MCommandReply(int _r, std::string_view s) - : Message(MSG_COMMAND_REPLY), + : MessageInstance(MSG_COMMAND_REPLY), r(_r), rs(s) { } private: ~MCommandReply() override {} diff --git a/src/messages/MConfig.h b/src/messages/MConfig.h index 1a0aa8d1f28..ca79b9aa39e 100644 --- a/src/messages/MConfig.h +++ b/src/messages/MConfig.h @@ -5,11 +5,8 @@ #include "msg/Message.h" -class MConfig : public Message { +class MConfig : public MessageInstance<MConfig> { public: - typedef boost::intrusive_ptr<MConfig> ref; - typedef boost::intrusive_ptr<MConfig const> const_ref; - using factory = MessageFactory<MConfig>; friend factory; static const int HEAD_VERSION = 1; @@ -17,9 +14,9 @@ public: map<string,string> config; - MConfig() : Message(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION) { } + MConfig() : MessageInstance(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION) { } MConfig(const map<string,string>& c) - : Message(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_CONFIG, HEAD_VERSION, COMPAT_VERSION), config(c) {} const char *get_type_name() const override { diff --git a/src/messages/MDataPing.h b/src/messages/MDataPing.h index 3d17669759d..664e7ebcbbe 100644 --- a/src/messages/MDataPing.h +++ b/src/messages/MDataPing.h @@ -28,11 +28,8 @@ struct xio_reg_mem {}; typedef void (*mdata_hook_func)(struct xio_reg_mem *mp); -class MDataPing : public Message { +class MDataPing : public MessageInstance<MDataPing> { public: - typedef boost::intrusive_ptr<MDataPing> ref; - typedef boost::intrusive_ptr<MDataPing const> const_ref; - using factory = MessageFactory<MDataPing>; friend factory; static const int HEAD_VERSION = 1; @@ -45,7 +42,7 @@ public: bool free_data; MDataPing() - : Message(MSG_DATA_PING, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_DATA_PING, HEAD_VERSION, COMPAT_VERSION), mdata_hook(NULL), free_data(false) {} diff --git a/src/messages/MDentryLink.h b/src/messages/MDentryLink.h index 8b483c88185..3ec69afe128 100644 --- a/src/messages/MDentryLink.h +++ b/src/messages/MDentryLink.h @@ -20,11 +20,8 @@ #include "msg/Message.h" -class MDentryLink : public Message { +class MDentryLink : public MessageInstance<MDentryLink> { public: - typedef boost::intrusive_ptr<MDentryLink> ref; - typedef boost::intrusive_ptr<MDentryLink const> const_ref; - using factory = MessageFactory<MDentryLink>; friend factory; private: dirfrag_t subtree; @@ -42,9 +39,9 @@ private: protected: MDentryLink() : - Message(MSG_MDS_DENTRYLINK) { } + MessageInstance(MSG_MDS_DENTRYLINK) { } MDentryLink(dirfrag_t r, dirfrag_t df, std::string_view n, bool p) : - Message(MSG_MDS_DENTRYLINK), + MessageInstance(MSG_MDS_DENTRYLINK), subtree(r), dirfrag(df), dn(n), diff --git a/src/messages/MDentryUnlink.h b/src/messages/MDentryUnlink.h index e30827bb9f8..6ac339a84b2 100644 --- a/src/messages/MDentryUnlink.h +++ b/src/messages/MDentryUnlink.h @@ -20,11 +20,8 @@ #include "msg/Message.h" -class MDentryUnlink : public Message { +class MDentryUnlink : public MessageInstance<MDentryUnlink> { public: - typedef boost::intrusive_ptr<MDentryUnlink> ref; - typedef boost::intrusive_ptr<MDentryUnlink const> const_ref; - using factory = MessageFactory<MDentryUnlink>; friend factory; private: @@ -40,9 +37,9 @@ private: protected: MDentryUnlink() : - Message(MSG_MDS_DENTRYUNLINK) { } + MessageInstance(MSG_MDS_DENTRYUNLINK) { } MDentryUnlink(dirfrag_t df, std::string_view n) : - Message(MSG_MDS_DENTRYUNLINK), + MessageInstance(MSG_MDS_DENTRYUNLINK), dirfrag(df), dn(n) {} ~MDentryUnlink() override {} diff --git a/src/messages/MDirUpdate.h b/src/messages/MDirUpdate.h index c96ccaa1f27..b3e698d7aa1 100644 --- a/src/messages/MDirUpdate.h +++ b/src/messages/MDirUpdate.h @@ -18,11 +18,8 @@ #include "msg/Message.h" -class MDirUpdate : public Message { +class MDirUpdate : public MessageInstance<MDirUpdate> { public: - typedef boost::intrusive_ptr<MDirUpdate> ref; - typedef boost::intrusive_ptr<MDirUpdate const> const_ref; - using factory = MessageFactory<MDirUpdate>; friend factory; mds_rank_t get_source_mds() const { return from_mds; } @@ -62,19 +59,19 @@ public: protected: ~MDirUpdate() {} - MDirUpdate() : Message(MSG_MDS_DIRUPDATE) {} + MDirUpdate() : MessageInstance(MSG_MDS_DIRUPDATE) {} MDirUpdate(mds_rank_t f, dirfrag_t dirfrag, int dir_rep, const std::set<int32_t>& dir_rep_by, filepath& path, bool discover = false) : - Message(MSG_MDS_DIRUPDATE), from_mds(f), dirfrag(dirfrag), + MessageInstance(MSG_MDS_DIRUPDATE), from_mds(f), dirfrag(dirfrag), dir_rep(dir_rep), dir_rep_by(dir_rep_by), path(path) { this->discover = discover ? 5 : 0; } MDirUpdate(const MDirUpdate& m) - : Message(MSG_MDS_DIRUPDATE), + : MessageInstance(MSG_MDS_DIRUPDATE), from_mds(m.from_mds), dirfrag(m.dirfrag), dir_rep(m.dir_rep), diff --git a/src/messages/MDiscover.h b/src/messages/MDiscover.h index a55f50075d7..5f9196d066c 100644 --- a/src/messages/MDiscover.h +++ b/src/messages/MDiscover.h @@ -22,11 +22,8 @@ #include <string> -class MDiscover : public Message { +class MDiscover : public MessageInstance<MDiscover> { public: - typedef boost::intrusive_ptr<MDiscover> ref; - typedef boost::intrusive_ptr<MDiscover const> const_ref; - using factory = MessageFactory<MDiscover>; friend factory; private: @@ -53,14 +50,14 @@ private: void set_base_dir_frag(frag_t f) { base_dir_frag = f; } protected: - MDiscover() : Message(MSG_MDS_DISCOVER) { } + MDiscover() : MessageInstance(MSG_MDS_DISCOVER) { } MDiscover(inodeno_t base_ino_, frag_t base_frag_, snapid_t s, filepath& want_path_, bool want_base_dir_ = true, bool discover_xlocks_ = false) : - Message(MSG_MDS_DISCOVER), + MessageInstance(MSG_MDS_DISCOVER), base_ino(base_ino_), base_dir_frag(base_frag_), snapid(s), diff --git a/src/messages/MDiscoverReply.h b/src/messages/MDiscoverReply.h index c8ed8cbcf4b..a25fa135a6d 100644 --- a/src/messages/MDiscoverReply.h +++ b/src/messages/MDiscoverReply.h @@ -63,11 +63,8 @@ * */ -class MDiscoverReply : public Message { +class MDiscoverReply : public MessageInstance<MDiscoverReply> { public: - typedef boost::intrusive_ptr<MDiscoverReply> ref; - typedef boost::intrusive_ptr<MDiscoverReply const> const_ref; - using factory = MessageFactory<MDiscoverReply>; friend factory; private: static const int HEAD_VERSION = 2; @@ -114,9 +111,9 @@ private: void set_base_dir_frag(frag_t df) { base_dir_frag = df; } protected: - MDiscoverReply() : Message(MSG_MDS_DISCOVERREPLY, HEAD_VERSION) { } + MDiscoverReply() : MessageInstance(MSG_MDS_DISCOVERREPLY, HEAD_VERSION) { } MDiscoverReply(const MDiscover &dis) : - Message(MSG_MDS_DISCOVERREPLY, HEAD_VERSION), + MessageInstance(MSG_MDS_DISCOVERREPLY, HEAD_VERSION), base_ino(dis.get_base_ino()), base_dir_frag(dis.get_base_dir_frag()), wanted_base_dir(dis.wants_base_dir()), @@ -131,7 +128,7 @@ protected: header.tid = dis.get_tid(); } MDiscoverReply(dirfrag_t df) : - Message(MSG_MDS_DISCOVERREPLY, HEAD_VERSION), + MessageInstance(MSG_MDS_DISCOVERREPLY, HEAD_VERSION), base_ino(df.ino), base_dir_frag(df.frag), wanted_base_dir(false), diff --git a/src/messages/MExportCaps.h b/src/messages/MExportCaps.h index 437ec785df0..0b91f48ac4b 100644 --- a/src/messages/MExportCaps.h +++ b/src/messages/MExportCaps.h @@ -19,11 +19,8 @@ #include "msg/Message.h" -class MExportCaps : public Message { +class MExportCaps : public MessageInstance<MExportCaps> { public: - typedef boost::intrusive_ptr<MExportCaps> ref; - typedef boost::intrusive_ptr<MExportCaps const> const_ref; - using factory = MessageFactory<MExportCaps>; friend factory; private: static const int HEAD_VERSION = 2; @@ -36,7 +33,7 @@ private: protected: MExportCaps() : - Message(MSG_MDS_EXPORTCAPS, HEAD_VERSION, COMPAT_VERSION) {} + MessageInstance(MSG_MDS_EXPORTCAPS, HEAD_VERSION, COMPAT_VERSION) {} ~MExportCaps() override {} public: diff --git a/src/messages/MExportCapsAck.h b/src/messages/MExportCapsAck.h index 4479df5a9dd..3aeefffc3d8 100644 --- a/src/messages/MExportCapsAck.h +++ b/src/messages/MExportCapsAck.h @@ -19,11 +19,8 @@ #include "msg/Message.h" -class MExportCapsAck : public Message { +class MExportCapsAck : public MessageInstance<MExportCapsAck> { public: - typedef boost::intrusive_ptr<MExportCapsAck> ref; - typedef boost::intrusive_ptr<MExportCapsAck const> const_ref; - using factory = MessageFactory<MExportCapsAck>; friend factory; inodeno_t ino; @@ -31,9 +28,9 @@ public: protected: MExportCapsAck() : - Message(MSG_MDS_EXPORTCAPSACK) {} + MessageInstance(MSG_MDS_EXPORTCAPSACK) {} MExportCapsAck(inodeno_t i) : - Message(MSG_MDS_EXPORTCAPSACK), ino(i) {} + MessageInstance(MSG_MDS_EXPORTCAPSACK), ino(i) {} ~MExportCapsAck() override {} public: diff --git a/src/messages/MExportDir.h b/src/messages/MExportDir.h index 8c5e3284b30..4a451beeef4 100644 --- a/src/messages/MExportDir.h +++ b/src/messages/MExportDir.h @@ -19,11 +19,8 @@ #include "msg/Message.h" -class MExportDir : public Message { +class MExportDir : public MessageInstance<MExportDir> { public: - typedef boost::intrusive_ptr<MExportDir>ref; - typedef boost::intrusive_ptr<MExportDir const> const_ref; - using factory = MessageFactory<MExportDir>; friend factory; dirfrag_t dirfrag; bufferlist export_data; @@ -31,9 +28,9 @@ public: bufferlist client_map; protected: - MExportDir() : Message(MSG_MDS_EXPORTDIR) {} + MExportDir() : MessageInstance(MSG_MDS_EXPORTDIR) {} MExportDir(dirfrag_t df, uint64_t tid) : - Message(MSG_MDS_EXPORTDIR), dirfrag(df) { + MessageInstance(MSG_MDS_EXPORTDIR), dirfrag(df) { set_tid(tid); } ~MExportDir() override {} diff --git a/src/messages/MExportDirAck.h b/src/messages/MExportDirAck.h index e88df8494ef..ee8b68f98d0 100644 --- a/src/messages/MExportDirAck.h +++ b/src/messages/MExportDirAck.h @@ -18,11 +18,8 @@ #include "MExportDir.h" #include "msg/Message.h" -class MExportDirAck : public Message { +class MExportDirAck : public MessageInstance<MExportDirAck> { public: - typedef boost::intrusive_ptr<MExportDirAck> ref; - typedef boost::intrusive_ptr<MExportDirAck const> const_ref; - using factory = MessageFactory<MExportDirAck>; friend factory; dirfrag_t dirfrag; @@ -31,9 +28,9 @@ public: dirfrag_t get_dirfrag() const { return dirfrag; } protected: - MExportDirAck() : Message(MSG_MDS_EXPORTDIRACK) {} + MExportDirAck() : MessageInstance(MSG_MDS_EXPORTDIRACK) {} MExportDirAck(dirfrag_t df, uint64_t tid) : - Message(MSG_MDS_EXPORTDIRACK), dirfrag(df) { + MessageInstance(MSG_MDS_EXPORTDIRACK), dirfrag(df) { set_tid(tid); } ~MExportDirAck() override {} diff --git a/src/messages/MExportDirCancel.h b/src/messages/MExportDirCancel.h index 635abfec825..54f9bec7142 100644 --- a/src/messages/MExportDirCancel.h +++ b/src/messages/MExportDirCancel.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "include/types.h" -class MExportDirCancel : public Message { +class MExportDirCancel : public MessageInstance<MExportDirCancel> { public: - typedef boost::intrusive_ptr<MExportDirCancel> ref; - typedef boost::intrusive_ptr<MExportDirCancel const> const_ref; - using factory = MessageFactory<MExportDirCancel>; friend factory; private: dirfrag_t dirfrag; @@ -31,9 +28,9 @@ private: dirfrag_t get_dirfrag() const { return dirfrag; } protected: - MExportDirCancel() : Message(MSG_MDS_EXPORTDIRCANCEL) {} + MExportDirCancel() : MessageInstance(MSG_MDS_EXPORTDIRCANCEL) {} MExportDirCancel(dirfrag_t df, uint64_t tid) : - Message(MSG_MDS_EXPORTDIRCANCEL), dirfrag(df) { + MessageInstance(MSG_MDS_EXPORTDIRCANCEL), dirfrag(df) { set_tid(tid); } ~MExportDirCancel() override {} diff --git a/src/messages/MExportDirDiscover.h b/src/messages/MExportDirDiscover.h index bcd3f1f3450..7264e7c2487 100644 --- a/src/messages/MExportDirDiscover.h +++ b/src/messages/MExportDirDiscover.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "include/types.h" -class MExportDirDiscover : public Message { +class MExportDirDiscover : public MessageInstance<MExportDirDiscover> { public: - typedef boost::intrusive_ptr<MExportDirDiscover> ref; - typedef boost::intrusive_ptr<MExportDirDiscover const> const_ref; - using factory = MessageFactory<MExportDirDiscover>; friend factory; private: mds_rank_t from = -1; @@ -39,10 +36,10 @@ private: protected: MExportDirDiscover() : - Message(MSG_MDS_EXPORTDIRDISCOVER), + MessageInstance(MSG_MDS_EXPORTDIRDISCOVER), started(false) { } MExportDirDiscover(dirfrag_t df, filepath& p, mds_rank_t f, uint64_t tid) : - Message(MSG_MDS_EXPORTDIRDISCOVER), + MessageInstance(MSG_MDS_EXPORTDIRDISCOVER), from(f), dirfrag(df), path(p), started(false) { set_tid(tid); } diff --git a/src/messages/MExportDirDiscoverAck.h b/src/messages/MExportDirDiscoverAck.h index a663506156f..ba769c3c225 100644 --- a/src/messages/MExportDirDiscoverAck.h +++ b/src/messages/MExportDirDiscoverAck.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "include/types.h" -class MExportDirDiscoverAck : public Message { +class MExportDirDiscoverAck : public MessageInstance<MExportDirDiscoverAck> { public: - typedef boost::intrusive_ptr<MExportDirDiscoverAck> ref; - typedef boost::intrusive_ptr<MExportDirDiscoverAck const> const_ref; - using factory = MessageFactory<MExportDirDiscoverAck>; friend factory; private: dirfrag_t dirfrag; @@ -34,9 +31,9 @@ private: bool is_success() const { return success; } protected: - MExportDirDiscoverAck() : Message(MSG_MDS_EXPORTDIRDISCOVERACK) {} + MExportDirDiscoverAck() : MessageInstance(MSG_MDS_EXPORTDIRDISCOVERACK) {} MExportDirDiscoverAck(dirfrag_t df, uint64_t tid, bool s=true) : - Message(MSG_MDS_EXPORTDIRDISCOVERACK), + MessageInstance(MSG_MDS_EXPORTDIRDISCOVERACK), dirfrag(df), success(s) { set_tid(tid); } diff --git a/src/messages/MExportDirFinish.h b/src/messages/MExportDirFinish.h index 8c19ba55b64..e538518c244 100644 --- a/src/messages/MExportDirFinish.h +++ b/src/messages/MExportDirFinish.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MExportDirFinish : public Message { +class MExportDirFinish : public MessageInstance<MExportDirFinish> { public: - typedef boost::intrusive_ptr<MExportDirFinish> ref; - typedef boost::intrusive_ptr<MExportDirFinish const> const_ref; - using factory = MessageFactory<MExportDirFinish>; friend factory; private: dirfrag_t dirfrag; @@ -34,7 +31,7 @@ private: protected: MExportDirFinish() : last(false) {} MExportDirFinish(dirfrag_t df, bool l, uint64_t tid) : - Message(MSG_MDS_EXPORTDIRFINISH), dirfrag(df), last(l) { + MessageInstance(MSG_MDS_EXPORTDIRFINISH), dirfrag(df), last(l) { set_tid(tid); } ~MExportDirFinish() override {} diff --git a/src/messages/MExportDirNotify.h b/src/messages/MExportDirNotify.h index 3004f3665f9..8c8c756ac51 100644 --- a/src/messages/MExportDirNotify.h +++ b/src/messages/MExportDirNotify.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MExportDirNotify : public Message { +class MExportDirNotify : public MessageInstance<MExportDirNotify> { public: - typedef boost::intrusive_ptr<MExportDirNotify> ref; - typedef boost::intrusive_ptr<MExportDirNotify const> const_ref; - using factory = MessageFactory<MExportDirNotify>; friend factory; private: dirfrag_t base; @@ -40,7 +37,7 @@ private: protected: MExportDirNotify() {} MExportDirNotify(dirfrag_t i, uint64_t tid, bool a, pair<__s32,__s32> oa, pair<__s32,__s32> na) : - Message(MSG_MDS_EXPORTDIRNOTIFY), + MessageInstance(MSG_MDS_EXPORTDIRNOTIFY), base(i), ack(a), old_auth(oa), new_auth(na) { set_tid(tid); } diff --git a/src/messages/MExportDirNotifyAck.h b/src/messages/MExportDirNotifyAck.h index 844d9ec77a0..6d1ed62c9d5 100644 --- a/src/messages/MExportDirNotifyAck.h +++ b/src/messages/MExportDirNotifyAck.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MExportDirNotifyAck : public Message { +class MExportDirNotifyAck : public MessageInstance<MExportDirNotifyAck> { public: - typedef boost::intrusive_ptr<MExportDirNotifyAck>ref; - typedef boost::intrusive_ptr<MExportDirNotifyAck const> const_ref; - using factory = MessageFactory<MExportDirNotifyAck>; friend factory; private: dirfrag_t dirfrag; @@ -34,7 +31,7 @@ private: protected: MExportDirNotifyAck() {} MExportDirNotifyAck(dirfrag_t df, uint64_t tid, pair<__s32,__s32> na) : - Message(MSG_MDS_EXPORTDIRNOTIFYACK), dirfrag(df), new_auth(na) { + MessageInstance(MSG_MDS_EXPORTDIRNOTIFYACK), dirfrag(df), new_auth(na) { set_tid(tid); } ~MExportDirNotifyAck() override {} diff --git a/src/messages/MExportDirPrep.h b/src/messages/MExportDirPrep.h index 01d5b244f7d..950fbf60241 100644 --- a/src/messages/MExportDirPrep.h +++ b/src/messages/MExportDirPrep.h @@ -19,11 +19,8 @@ #include "msg/Message.h" #include "include/types.h" -class MExportDirPrep : public Message { +class MExportDirPrep : public MessageInstance<MExportDirPrep> { public: - typedef boost::intrusive_ptr<MExportDirPrep> ref; - typedef boost::intrusive_ptr<MExportDirPrep const> const_ref; - using factory = MessageFactory<MExportDirPrep>; friend factory; private: dirfrag_t dirfrag; @@ -48,7 +45,7 @@ protected: b_did_assim = false; } MExportDirPrep(dirfrag_t df, uint64_t tid) : - Message(MSG_MDS_EXPORTDIRPREP), + MessageInstance(MSG_MDS_EXPORTDIRPREP), dirfrag(df), b_did_assim(false) { set_tid(tid); } diff --git a/src/messages/MExportDirPrepAck.h b/src/messages/MExportDirPrepAck.h index 130ce65ea38..498dbdd1474 100644 --- a/src/messages/MExportDirPrepAck.h +++ b/src/messages/MExportDirPrepAck.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "include/types.h" -class MExportDirPrepAck : public Message { +class MExportDirPrepAck : public MessageInstance<MExportDirPrepAck> { public: - typedef boost::intrusive_ptr<MExportDirPrepAck> ref; - typedef boost::intrusive_ptr<MExportDirPrepAck const> const_ref; - using factory = MessageFactory<MExportDirPrepAck>; friend factory; private: dirfrag_t dirfrag; @@ -34,7 +31,7 @@ private: protected: MExportDirPrepAck() {} MExportDirPrepAck(dirfrag_t df, bool s, uint64_t tid) : - Message(MSG_MDS_EXPORTDIRPREPACK), dirfrag(df), success(s) { + MessageInstance(MSG_MDS_EXPORTDIRPREPACK), dirfrag(df), success(s) { set_tid(tid); } ~MExportDirPrepAck() override {} diff --git a/src/messages/MFSMap.h b/src/messages/MFSMap.h index 67ab3506a01..4ce2783ba14 100644 --- a/src/messages/MFSMap.h +++ b/src/messages/MFSMap.h @@ -20,11 +20,8 @@ #include "mds/FSMap.h" #include "include/ceph_features.h" -class MFSMap : public Message { +class MFSMap : public MessageInstance<MFSMap> { public: - typedef boost::intrusive_ptr<MFSMap> ref; - typedef boost::intrusive_ptr<MFSMap const> const_ref; - using factory = MessageFactory<MFSMap>; friend factory; epoch_t epoch; @@ -34,9 +31,9 @@ public: const FSMap & get_fsmap() {return fsmap;} MFSMap() : - Message(CEPH_MSG_FS_MAP), epoch(0) {} + MessageInstance(CEPH_MSG_FS_MAP), epoch(0) {} MFSMap(const uuid_d &f, const FSMap &fsmap_) : - Message(CEPH_MSG_FS_MAP), epoch(fsmap_.get_epoch()) + MessageInstance(CEPH_MSG_FS_MAP), epoch(fsmap_.get_epoch()) { fsmap = fsmap_; } diff --git a/src/messages/MFSMapUser.h b/src/messages/MFSMapUser.h index a5c06f460ca..eb245f9d66f 100644 --- a/src/messages/MFSMapUser.h +++ b/src/messages/MFSMapUser.h @@ -19,11 +19,8 @@ #include "mds/FSMapUser.h" #include "include/ceph_features.h" -class MFSMapUser : public Message { +class MFSMapUser : public MessageInstance<MFSMapUser> { public: - typedef boost::intrusive_ptr<MFSMapUser> ref; - typedef boost::intrusive_ptr<MFSMapUser const> const_ref; - using factory = MessageFactory<MFSMapUser>; friend factory; epoch_t epoch; @@ -32,9 +29,9 @@ public: const FSMapUser & get_fsmap() { return fsmap; } MFSMapUser() : - Message(CEPH_MSG_FS_MAP_USER), epoch(0) {} + MessageInstance(CEPH_MSG_FS_MAP_USER), epoch(0) {} MFSMapUser(const uuid_d &f, const FSMapUser &fsmap_) : - Message(CEPH_MSG_FS_MAP_USER), epoch(fsmap_.epoch) + MessageInstance(CEPH_MSG_FS_MAP_USER), epoch(fsmap_.epoch) { fsmap = fsmap_; } diff --git a/src/messages/MForward.h b/src/messages/MForward.h index 9f681a34935..9b34c086f95 100644 --- a/src/messages/MForward.h +++ b/src/messages/MForward.h @@ -24,11 +24,8 @@ #include "include/encoding.h" #include "include/stringify.h" -class MForward : public Message { +class MForward : public MessageInstance<MForward> { public: - typedef boost::intrusive_ptr<MForward> ref; - typedef boost::intrusive_ptr<MForward const> const_ref; - using factory = MessageFactory<MForward>; friend factory; uint64_t tid; @@ -45,11 +42,11 @@ public: static const int HEAD_VERSION = 4; static const int COMPAT_VERSION = 4; - MForward() : Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), + MForward() : MessageInstance(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), tid(0), con_features(0), msg(NULL) {} //the message needs to have caps filled in! MForward(uint64_t t, PaxosServiceMessage *m, uint64_t feat) : - Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), tid(t), msg(NULL) { client_type = m->get_source().type(); client_addrs = m->get_source_addrs(); @@ -64,7 +61,7 @@ public: } MForward(uint64_t t, PaxosServiceMessage *m, uint64_t feat, const MonCap& caps) : - Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION), tid(t), client_caps(caps), msg(NULL) { client_type = m->get_source().type(); client_addrs = m->get_source_addrs(); diff --git a/src/messages/MGatherCaps.h b/src/messages/MGatherCaps.h index 8555f89551d..f05ddf6a7f3 100644 --- a/src/messages/MGatherCaps.h +++ b/src/messages/MGatherCaps.h @@ -4,11 +4,8 @@ #include "msg/Message.h" -class MGatherCaps : public Message { +class MGatherCaps : public MessageInstance<MGatherCaps> { public: - typedef boost::intrusive_ptr<MGatherCaps> ref; - typedef boost::intrusive_ptr<MGatherCaps const> const_ref; - using factory = MessageFactory<MGatherCaps>; friend factory; @@ -16,7 +13,7 @@ public: protected: MGatherCaps() : - Message(MSG_MDS_GATHERCAPS) {} + MessageInstance(MSG_MDS_GATHERCAPS) {} ~MGatherCaps() override {} public: diff --git a/src/messages/MGenericMessage.h b/src/messages/MGenericMessage.h index 7ef0f6beff8..7b2f85df5e2 100644 --- a/src/messages/MGenericMessage.h +++ b/src/messages/MGenericMessage.h @@ -18,18 +18,15 @@ #include "msg/Message.h" -class MGenericMessage : public Message { +class MGenericMessage : public MessageInstance<MGenericMessage> { public: - typedef boost::intrusive_ptr<MGenericMessage> ref; - typedef boost::intrusive_ptr<MGenericMessage const> const_ref; - using factory = MessageFactory<MGenericMessage>; friend factory; private: char tname[20]; //long pcid; public: - MGenericMessage(int t=0) : Message(t) { + MGenericMessage(int t=0) : MessageInstance(t) { snprintf(tname, sizeof(tname), "generic%d", get_type()); } diff --git a/src/messages/MGetConfig.h b/src/messages/MGetConfig.h index d7add127e18..11fc6c6fabb 100644 --- a/src/messages/MGetConfig.h +++ b/src/messages/MGetConfig.h @@ -5,11 +5,8 @@ #include "msg/Message.h" -class MGetConfig : public Message { +class MGetConfig : public MessageInstance<MGetConfig> { public: - typedef boost::intrusive_ptr<MGetConfig> ref; - typedef boost::intrusive_ptr<MGetConfig const> const_ref; - using factory = MessageFactory<MGetConfig>; friend factory; static const int HEAD_VERSION = 1; @@ -19,9 +16,9 @@ public: string host; ///< our hostname string device_class; - MGetConfig() : Message(MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION) { } + MGetConfig() : MessageInstance(MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION) { } MGetConfig(const EntityName& n, const string& h) - : Message(MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_GET_CONFIG, HEAD_VERSION, COMPAT_VERSION), name(n), host(h) {} diff --git a/src/messages/MGetPoolStats.h b/src/messages/MGetPoolStats.h index a21c6eb5c4b..98103f37872 100644 --- a/src/messages/MGetPoolStats.h +++ b/src/messages/MGetPoolStats.h @@ -18,19 +18,16 @@ #include "messages/PaxosServiceMessage.h" -class MGetPoolStats : public PaxosServiceMessage { +class MGetPoolStats : public MessageInstance<MGetPoolStats, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MGetPoolStats> ref; - typedef boost::intrusive_ptr<MGetPoolStats const> const_ref; - using factory = MessageFactory<MGetPoolStats>; friend factory; uuid_d fsid; list<string> pools; - MGetPoolStats() : PaxosServiceMessage(MSG_GETPOOLSTATS, 0) {} + MGetPoolStats() : MessageInstance(MSG_GETPOOLSTATS, 0) {} MGetPoolStats(const uuid_d& f, ceph_tid_t t, list<string>& ls, version_t l) : - PaxosServiceMessage(MSG_GETPOOLSTATS, l), + MessageInstance(MSG_GETPOOLSTATS, l), fsid(f), pools(ls) { set_tid(t); } diff --git a/src/messages/MGetPoolStatsReply.h b/src/messages/MGetPoolStatsReply.h index af4834b678a..378b80448d5 100644 --- a/src/messages/MGetPoolStatsReply.h +++ b/src/messages/MGetPoolStatsReply.h @@ -16,19 +16,16 @@ #ifndef CEPH_MGETPOOLSTATSREPLY_H #define CEPH_MGETPOOLSTATSREPLY_H -class MGetPoolStatsReply : public PaxosServiceMessage { +class MGetPoolStatsReply : public MessageInstance<MGetPoolStatsReply, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MGetPoolStatsReply> ref; - typedef boost::intrusive_ptr<MGetPoolStatsReply const> const_ref; - using factory = MessageFactory<MGetPoolStatsReply>; friend factory; uuid_d fsid; map<string,pool_stat_t> pool_stats; - MGetPoolStatsReply() : PaxosServiceMessage(MSG_GETPOOLSTATSREPLY, 0) {} + MGetPoolStatsReply() : MessageInstance(MSG_GETPOOLSTATSREPLY, 0) {} MGetPoolStatsReply(uuid_d& f, ceph_tid_t t, version_t v) : - PaxosServiceMessage(MSG_GETPOOLSTATSREPLY, v), + MessageInstance(MSG_GETPOOLSTATSREPLY, v), fsid(f) { set_tid(t); } diff --git a/src/messages/MHeartbeat.h b/src/messages/MHeartbeat.h index 4d3c2001cf8..bb142834392 100644 --- a/src/messages/MHeartbeat.h +++ b/src/messages/MHeartbeat.h @@ -20,11 +20,8 @@ #include "msg/Message.h" #include "common/DecayCounter.h" -class MHeartbeat : public Message { +class MHeartbeat : public MessageInstance<MHeartbeat> { public: - typedef boost::intrusive_ptr<MHeartbeat> ref; - typedef boost::intrusive_ptr<MHeartbeat const> const_ref; - using factory = MessageFactory<MHeartbeat>; friend factory; private: mds_load_t load; @@ -39,9 +36,9 @@ private: map<mds_rank_t, float>& get_import_map() { return import_map; } protected: - MHeartbeat() : Message(MSG_MDS_HEARTBEAT), load(DecayRate()) {} + MHeartbeat() : MessageInstance(MSG_MDS_HEARTBEAT), load(DecayRate()) {} MHeartbeat(mds_load_t& load, int beat) - : Message(MSG_MDS_HEARTBEAT), + : MessageInstance(MSG_MDS_HEARTBEAT), load(load) { this->beat = beat; } diff --git a/src/messages/MInodeFileCaps.h b/src/messages/MInodeFileCaps.h index a09189ec15d..c01c487b4dd 100644 --- a/src/messages/MInodeFileCaps.h +++ b/src/messages/MInodeFileCaps.h @@ -18,11 +18,8 @@ #include "msg/Message.h" -class MInodeFileCaps : public Message { +class MInodeFileCaps : public MessageInstance<MInodeFileCaps> { public: - typedef boost::intrusive_ptr<MInodeFileCaps> ref; - typedef boost::intrusive_ptr<MInodeFileCaps const> const_ref; - using factory = MessageFactory<MInodeFileCaps>; friend factory; private: inodeno_t ino; @@ -34,9 +31,9 @@ private: int get_caps() const { return caps; } protected: - MInodeFileCaps() : Message(MSG_MDS_INODEFILECAPS) {} + MInodeFileCaps() : MessageInstance(MSG_MDS_INODEFILECAPS) {} MInodeFileCaps(inodeno_t ino, int caps) : - Message(MSG_MDS_INODEFILECAPS) { + MessageInstance(MSG_MDS_INODEFILECAPS) { this->ino = ino; this->caps = caps; } diff --git a/src/messages/MLock.h b/src/messages/MLock.h index 6e1cdccf3fc..12811e2f72d 100644 --- a/src/messages/MLock.h +++ b/src/messages/MLock.h @@ -20,11 +20,8 @@ #include "mds/locks.h" #include "mds/SimpleLock.h" -class MLock : public Message { +class MLock : public MessageInstance<MLock> { public: - typedef boost::intrusive_ptr<MLock> ref; - typedef boost::intrusive_ptr<MLock const> const_ref; - using factory = MessageFactory<MLock>; friend factory; private: int32_t action = 0; // action type @@ -48,19 +45,19 @@ public: MDSCacheObjectInfo &get_object_info() { return object_info; } protected: - MLock() : Message(MSG_MDS_LOCK) {} + MLock() : MessageInstance(MSG_MDS_LOCK) {} MLock(int ac, mds_rank_t as) : - Message(MSG_MDS_LOCK), + MessageInstance(MSG_MDS_LOCK), action(ac), asker(as), lock_type(0) { } MLock(SimpleLock *lock, int ac, mds_rank_t as) : - Message(MSG_MDS_LOCK), + MessageInstance(MSG_MDS_LOCK), action(ac), asker(as), lock_type(lock->get_type()) { lock->get_parent()->set_object_info(object_info); } MLock(SimpleLock *lock, int ac, mds_rank_t as, bufferlist& bl) : - Message(MSG_MDS_LOCK), + MessageInstance(MSG_MDS_LOCK), action(ac), asker(as), lock_type(lock->get_type()) { lock->get_parent()->set_object_info(object_info); lockdata.claim(bl); diff --git a/src/messages/MLog.h b/src/messages/MLog.h index 01e56418352..84ce8d7a7dd 100644 --- a/src/messages/MLog.h +++ b/src/messages/MLog.h @@ -20,20 +20,17 @@ #include <deque> -class MLog : public PaxosServiceMessage { +class MLog : public MessageInstance<MLog, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MLog> ref; - typedef boost::intrusive_ptr<MLog const> const_ref; - using factory = MessageFactory<MLog>; friend factory; uuid_d fsid; std::deque<LogEntry> entries; - MLog() : PaxosServiceMessage(MSG_LOG, 0) {} + MLog() : MessageInstance(MSG_LOG, 0) {} MLog(const uuid_d& f, const std::deque<LogEntry>& e) - : PaxosServiceMessage(MSG_LOG, 0), fsid(f), entries(e) { } - MLog(const uuid_d& f) : PaxosServiceMessage(MSG_LOG, 0), fsid(f) { } + : MessageInstance(MSG_LOG, 0), fsid(f), entries(e) { } + MLog(const uuid_d& f) : MessageInstance(MSG_LOG, 0), fsid(f) { } private: ~MLog() override {} diff --git a/src/messages/MLogAck.h b/src/messages/MLogAck.h index 91f74e9ac29..a696c6fdf42 100644 --- a/src/messages/MLogAck.h +++ b/src/messages/MLogAck.h @@ -15,19 +15,16 @@ #ifndef CEPH_MLOGACK_H #define CEPH_MLOGACK_H -class MLogAck : public Message { +class MLogAck : public MessageInstance<MLogAck> { public: - typedef boost::intrusive_ptr<MLogAck> ref; - typedef boost::intrusive_ptr<MLogAck const> const_ref; - using factory = MessageFactory<MLogAck>; friend factory; uuid_d fsid; version_t last = 0; std::string channel; - MLogAck() : Message(MSG_LOGACK) {} - MLogAck(uuid_d& f, version_t l) : Message(MSG_LOGACK), fsid(f), last(l) {} + MLogAck() : MessageInstance(MSG_LOGACK) {} + MLogAck(uuid_d& f, version_t l) : MessageInstance(MSG_LOGACK), fsid(f), last(l) {} private: ~MLogAck() override {} diff --git a/src/messages/MMDSBeacon.h b/src/messages/MMDSBeacon.h index 00ef1a7decf..e72e20d1068 100644 --- a/src/messages/MMDSBeacon.h +++ b/src/messages/MMDSBeacon.h @@ -179,11 +179,8 @@ struct MDSHealth WRITE_CLASS_ENCODER(MDSHealth) -class MMDSBeacon : public PaxosServiceMessage { +class MMDSBeacon : public MessageInstance<MMDSBeacon, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMDSBeacon> ref; - typedef boost::intrusive_ptr<MMDSBeacon const> const_ref; - using factory = MessageFactory<MMDSBeacon>; friend factory; private: @@ -212,14 +209,14 @@ private: protected: MMDSBeacon() - : PaxosServiceMessage(MSG_MDS_BEACON, 0, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MDS_BEACON, 0, HEAD_VERSION, COMPAT_VERSION), global_id(0), state(MDSMap::STATE_NULL), standby_for_rank(MDS_RANK_NONE), standby_for_fscid(FS_CLUSTER_ID_NONE), standby_replay(false), mds_features(0) { set_priority(CEPH_MSG_PRIO_HIGH); } MMDSBeacon(const uuid_d &f, mds_gid_t g, const string& n, epoch_t les, MDSMap::DaemonState st, version_t se, uint64_t feat) : - PaxosServiceMessage(MSG_MDS_BEACON, les, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_MDS_BEACON, les, HEAD_VERSION, COMPAT_VERSION), fsid(f), global_id(g), name(n), state(st), seq(se), standby_for_rank(MDS_RANK_NONE), standby_for_fscid(FS_CLUSTER_ID_NONE), standby_replay(false), mds_features(feat) { diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h index 2929b9ca397..66e788b0bd7 100644 --- a/src/messages/MMDSCacheRejoin.h +++ b/src/messages/MMDSCacheRejoin.h @@ -27,11 +27,8 @@ // sent from replica to auth -class MMDSCacheRejoin : public Message { +class MMDSCacheRejoin : public MessageInstance<MMDSCacheRejoin> { public: - typedef boost::intrusive_ptr<MMDSCacheRejoin> ref; - typedef boost::intrusive_ptr<MMDSCacheRejoin const> const_ref; - using factory = MessageFactory<MMDSCacheRejoin>; friend factory; private: @@ -219,10 +216,10 @@ private: protected: MMDSCacheRejoin() : - Message(MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION), op(0) {} MMDSCacheRejoin(int o) : - Message(MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_MDS_CACHEREJOIN, HEAD_VERSION, COMPAT_VERSION), op(o) {} ~MMDSCacheRejoin() override {} diff --git a/src/messages/MMDSFindIno.h b/src/messages/MMDSFindIno.h index 31e4184b187..ca8e8df711f 100644 --- a/src/messages/MMDSFindIno.h +++ b/src/messages/MMDSFindIno.h @@ -18,19 +18,16 @@ #include "msg/Message.h" #include "include/filepath.h" -class MMDSFindIno : public Message { +class MMDSFindIno : public MessageInstance<MMDSFindIno> { public: - typedef boost::intrusive_ptr<MMDSFindIno> ref; - typedef boost::intrusive_ptr<MMDSFindIno const> const_ref; - using factory = MessageFactory<MMDSFindIno>; friend factory; ceph_tid_t tid {0}; inodeno_t ino; protected: - MMDSFindIno() : Message(MSG_MDS_FINDINO) {} - MMDSFindIno(ceph_tid_t t, inodeno_t i) : Message(MSG_MDS_FINDINO), tid(t), ino(i) {} + MMDSFindIno() : MessageInstance(MSG_MDS_FINDINO) {} + MMDSFindIno(ceph_tid_t t, inodeno_t i) : MessageInstance(MSG_MDS_FINDINO), tid(t), ino(i) {} ~MMDSFindIno() override {} public: diff --git a/src/messages/MMDSFindInoReply.h b/src/messages/MMDSFindInoReply.h index 162b830fc14..c8e110a3501 100644 --- a/src/messages/MMDSFindInoReply.h +++ b/src/messages/MMDSFindInoReply.h @@ -18,19 +18,16 @@ #include "msg/Message.h" #include "include/filepath.h" -class MMDSFindInoReply : public Message { +class MMDSFindInoReply : public MessageInstance<MMDSFindInoReply> { public: - typedef boost::intrusive_ptr<MMDSFindInoReply> ref; - typedef boost::intrusive_ptr<MMDSFindInoReply const> const_ref; - using factory = MessageFactory<MMDSFindInoReply>; friend factory; ceph_tid_t tid = 0; filepath path; protected: - MMDSFindInoReply() : Message(MSG_MDS_FINDINOREPLY) {} - MMDSFindInoReply(ceph_tid_t t) : Message(MSG_MDS_FINDINOREPLY), tid(t) {} + MMDSFindInoReply() : MessageInstance(MSG_MDS_FINDINOREPLY) {} + MMDSFindInoReply(ceph_tid_t t) : MessageInstance(MSG_MDS_FINDINOREPLY), tid(t) {} ~MMDSFindInoReply() override {} public: diff --git a/src/messages/MMDSFragmentNotify.h b/src/messages/MMDSFragmentNotify.h index 7be292a3a33..37e78f88e7b 100644 --- a/src/messages/MMDSFragmentNotify.h +++ b/src/messages/MMDSFragmentNotify.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MMDSFragmentNotify : public Message { +class MMDSFragmentNotify : public MessageInstance<MMDSFragmentNotify> { public: - typedef boost::intrusive_ptr<MMDSFragmentNotify> ref; - typedef boost::intrusive_ptr<MMDSFragmentNotify const> const_ref; - using factory = MessageFactory<MMDSFragmentNotify>; friend factory; private: inodeno_t ino; @@ -36,9 +33,9 @@ private: bufferlist basebl; protected: - MMDSFragmentNotify() : Message(MSG_MDS_FRAGMENTNOTIFY) {} + MMDSFragmentNotify() : MessageInstance(MSG_MDS_FRAGMENTNOTIFY) {} MMDSFragmentNotify(dirfrag_t df, int b) : - Message(MSG_MDS_FRAGMENTNOTIFY), + MessageInstance(MSG_MDS_FRAGMENTNOTIFY), ino(df.ino), basefrag(df.frag), bits(b) { } ~MMDSFragmentNotify() override {} diff --git a/src/messages/MMDSLoadTargets.h b/src/messages/MMDSLoadTargets.h index feda44e5fb9..554d80cda9e 100644 --- a/src/messages/MMDSLoadTargets.h +++ b/src/messages/MMDSLoadTargets.h @@ -23,20 +23,17 @@ #include <map> using std::map; -class MMDSLoadTargets : public PaxosServiceMessage { +class MMDSLoadTargets : public MessageInstance<MMDSLoadTargets, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMDSLoadTargets> ref; - typedef boost::intrusive_ptr<MMDSLoadTargets const> const_ref; - using factory = MessageFactory<MMDSLoadTargets>; friend factory; mds_gid_t global_id; set<mds_rank_t> targets; protected: - MMDSLoadTargets() : PaxosServiceMessage(MSG_MDS_OFFLOAD_TARGETS, 0) {} + MMDSLoadTargets() : MessageInstance(MSG_MDS_OFFLOAD_TARGETS, 0) {} MMDSLoadTargets(mds_gid_t g, set<mds_rank_t>& mds_targets) : - PaxosServiceMessage(MSG_MDS_OFFLOAD_TARGETS, 0), + MessageInstance(MSG_MDS_OFFLOAD_TARGETS, 0), global_id(g), targets(mds_targets) {} ~MMDSLoadTargets() override {} diff --git a/src/messages/MMDSMap.h b/src/messages/MMDSMap.h index 6ef9b368124..482d32a5b1c 100644 --- a/src/messages/MMDSMap.h +++ b/src/messages/MMDSMap.h @@ -20,11 +20,8 @@ #include "mds/MDSMap.h" #include "include/ceph_features.h" -class MMDSMap : public Message { +class MMDSMap : public MessageInstance<MMDSMap> { public: - typedef boost::intrusive_ptr<MMDSMap> ref; - typedef boost::intrusive_ptr<MMDSMap const> const_ref; - using factory = MessageFactory<MMDSMap>; friend factory; private: @@ -40,9 +37,9 @@ public: protected: MMDSMap() : - Message(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION) {} + MessageInstance(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION) {} MMDSMap(const uuid_d &f, const MDSMap &mm) : - Message(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(CEPH_MSG_MDS_MAP, HEAD_VERSION, COMPAT_VERSION), fsid(f) { epoch = mm.get_epoch(); mm.encode(encoded, -1); // we will reencode with fewer features as necessary diff --git a/src/messages/MMDSOpenIno.h b/src/messages/MMDSOpenIno.h index 1860f473ae9..f4636186d4c 100644 --- a/src/messages/MMDSOpenIno.h +++ b/src/messages/MMDSOpenIno.h @@ -17,20 +17,17 @@ #include "msg/Message.h" -class MMDSOpenIno : public Message { +class MMDSOpenIno : public MessageInstance<MMDSOpenIno> { public: - typedef boost::intrusive_ptr<MMDSOpenIno> ref; - typedef boost::intrusive_ptr<MMDSOpenIno const> const_ref; - using factory = MessageFactory<MMDSOpenIno>; friend factory; inodeno_t ino; vector<inode_backpointer_t> ancestors; protected: - MMDSOpenIno() : Message(MSG_MDS_OPENINO) {} + MMDSOpenIno() : MessageInstance(MSG_MDS_OPENINO) {} MMDSOpenIno(ceph_tid_t t, inodeno_t i, vector<inode_backpointer_t>* pa) : - Message(MSG_MDS_OPENINO), ino(i) { + MessageInstance(MSG_MDS_OPENINO), ino(i) { header.tid = t; if (pa) ancestors = *pa; diff --git a/src/messages/MMDSOpenInoReply.h b/src/messages/MMDSOpenInoReply.h index 2dc9c1ae10b..56cb37551ff 100644 --- a/src/messages/MMDSOpenInoReply.h +++ b/src/messages/MMDSOpenInoReply.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MMDSOpenInoReply : public Message { +class MMDSOpenInoReply : public MessageInstance<MMDSOpenInoReply> { public: - typedef boost::intrusive_ptr<MMDSOpenInoReply> ref; - typedef boost::intrusive_ptr<MMDSOpenInoReply const> const_ref; - using factory = MessageFactory<MMDSOpenInoReply>; friend factory; inodeno_t ino; @@ -30,9 +27,9 @@ public: int32_t error; protected: - MMDSOpenInoReply() : Message(MSG_MDS_OPENINOREPLY), error(0) {} + MMDSOpenInoReply() : MessageInstance(MSG_MDS_OPENINOREPLY), error(0) {} MMDSOpenInoReply(ceph_tid_t t, inodeno_t i, mds_rank_t h=MDS_RANK_NONE, int e=0) : - Message(MSG_MDS_OPENINOREPLY), ino(i), hint(h), error(e) { + MessageInstance(MSG_MDS_OPENINOREPLY), ino(i), hint(h), error(e) { header.tid = t; } diff --git a/src/messages/MMDSResolve.h b/src/messages/MMDSResolve.h index ca1dd9bdf7b..0b8ce139e0d 100644 --- a/src/messages/MMDSResolve.h +++ b/src/messages/MMDSResolve.h @@ -19,11 +19,8 @@ #include "include/types.h" -class MMDSResolve : public Message { +class MMDSResolve : public MessageInstance<MMDSResolve> { public: - typedef boost::intrusive_ptr<MMDSResolve> ref; - typedef boost::intrusive_ptr<MMDSResolve const> const_ref; - using factory = MessageFactory<MMDSResolve>; friend factory; map<dirfrag_t, vector<dirfrag_t> > subtrees; @@ -71,7 +68,7 @@ public: list<table_client> table_clients; protected: - MMDSResolve() : Message(MSG_MDS_RESOLVE) {} + MMDSResolve() : MessageInstance(MSG_MDS_RESOLVE) {} ~MMDSResolve() override {} public: diff --git a/src/messages/MMDSResolveAck.h b/src/messages/MMDSResolveAck.h index 97e26469ba9..8ce63c0ea5b 100644 --- a/src/messages/MMDSResolveAck.h +++ b/src/messages/MMDSResolveAck.h @@ -20,18 +20,15 @@ #include "include/types.h" -class MMDSResolveAck : public Message { +class MMDSResolveAck : public MessageInstance<MMDSResolveAck> { public: - typedef boost::intrusive_ptr<MMDSResolveAck> ref; - typedef boost::intrusive_ptr<MMDSResolveAck const> const_ref; - using factory = MessageFactory<MMDSResolveAck>; friend factory; map<metareqid_t, bufferlist> commit; vector<metareqid_t> abort; protected: - MMDSResolveAck() : Message(MSG_MDS_RESOLVEACK) {} + MMDSResolveAck() : MessageInstance(MSG_MDS_RESOLVEACK) {} ~MMDSResolveAck() override {} public: diff --git a/src/messages/MMDSSlaveRequest.h b/src/messages/MMDSSlaveRequest.h index c449a79042c..9e80aff627f 100644 --- a/src/messages/MMDSSlaveRequest.h +++ b/src/messages/MMDSSlaveRequest.h @@ -19,11 +19,8 @@ #include "msg/Message.h" #include "mds/mdstypes.h" -class MMDSSlaveRequest : public Message { +class MMDSSlaveRequest : public MessageInstance<MMDSSlaveRequest> { public: - typedef boost::intrusive_ptr<MMDSSlaveRequest> ref; - typedef boost::intrusive_ptr<MMDSSlaveRequest const> const_ref; - using factory = MessageFactory<MMDSSlaveRequest>; friend factory; static const int OP_XLOCK = 1; @@ -161,9 +158,9 @@ public: bufferlist& get_lock_data() { return inode_export; } protected: - MMDSSlaveRequest() : Message(MSG_MDS_SLAVE_REQUEST) { } + MMDSSlaveRequest() : MessageInstance(MSG_MDS_SLAVE_REQUEST) { } MMDSSlaveRequest(metareqid_t ri, __u32 att, int o) : - Message(MSG_MDS_SLAVE_REQUEST), + MessageInstance(MSG_MDS_SLAVE_REQUEST), reqid(ri), attempt(att), op(o), flags(0), lock_type(0), inode_export_v(0), srcdn_auth(MDS_RANK_NONE) { } ~MMDSSlaveRequest() override {} diff --git a/src/messages/MMDSSnapUpdate.h b/src/messages/MMDSSnapUpdate.h index b9063a58e03..e8672c68e95 100644 --- a/src/messages/MMDSSnapUpdate.h +++ b/src/messages/MMDSSnapUpdate.h @@ -17,11 +17,8 @@ #include "msg/Message.h" -class MMDSSnapUpdate : public Message { +class MMDSSnapUpdate : public MessageInstance<MMDSSnapUpdate> { public: - typedef boost::intrusive_ptr<MMDSSnapUpdate> ref; - typedef boost::intrusive_ptr<MMDSSnapUpdate const> const_ref; - using factory = MessageFactory<MMDSSnapUpdate>; friend factory; private: @@ -35,9 +32,9 @@ public: bufferlist snap_blob; protected: - MMDSSnapUpdate() : Message(MSG_MDS_SNAPUPDATE) {} + MMDSSnapUpdate() : MessageInstance(MSG_MDS_SNAPUPDATE) {} MMDSSnapUpdate(inodeno_t i, version_t tid, int op) : - Message(MSG_MDS_SNAPUPDATE), ino(i), snap_op(op) { + MessageInstance(MSG_MDS_SNAPUPDATE), ino(i), snap_op(op) { set_tid(tid); } ~MMDSSnapUpdate() override {} diff --git a/src/messages/MMDSTableRequest.h b/src/messages/MMDSTableRequest.h index 8504584f80c..ae952676e28 100644 --- a/src/messages/MMDSTableRequest.h +++ b/src/messages/MMDSTableRequest.h @@ -19,11 +19,8 @@ #include "msg/Message.h" #include "mds/mds_table_types.h" -class MMDSTableRequest : public Message { +class MMDSTableRequest : public MessageInstance<MMDSTableRequest> { public: - typedef boost::intrusive_ptr<MMDSTableRequest> ref; - typedef boost::intrusive_ptr<MMDSTableRequest const> const_ref; - using factory = MessageFactory<MMDSTableRequest>; friend factory; __u16 table = 0; @@ -32,9 +29,9 @@ public: bufferlist bl; protected: - MMDSTableRequest() : Message(MSG_MDS_TABLE_REQUEST) {} + MMDSTableRequest() : MessageInstance(MSG_MDS_TABLE_REQUEST) {} MMDSTableRequest(int tab, int o, uint64_t r, version_t v=0) : - Message(MSG_MDS_TABLE_REQUEST), + MessageInstance(MSG_MDS_TABLE_REQUEST), table(tab), op(o), reqid(r) { set_tid(v); } diff --git a/src/messages/MMgrBeacon.h b/src/messages/MMgrBeacon.h index 91e7208a1d3..58905771db6 100644 --- a/src/messages/MMgrBeacon.h +++ b/src/messages/MMgrBeacon.h @@ -22,11 +22,8 @@ #include "include/types.h" -class MMgrBeacon : public PaxosServiceMessage { +class MMgrBeacon : public MessageInstance<MMgrBeacon, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMgrBeacon> ref; - typedef boost::intrusive_ptr<MMgrBeacon const> const_ref; - using factory = MessageFactory<MMgrBeacon>; friend factory; private: @@ -53,7 +50,7 @@ protected: public: MMgrBeacon() - : PaxosServiceMessage(MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION), gid(0), available(false) { } @@ -62,7 +59,7 @@ public: entity_addrvec_t server_addrs_, bool available_, std::vector<MgrMap::ModuleInfo>&& modules_, map<string,string>&& metadata_) - : PaxosServiceMessage(MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MGR_BEACON, 0, HEAD_VERSION, COMPAT_VERSION), gid(gid_), server_addrs(server_addrs_), available(available_), name(name_), fsid(fsid_), modules(std::move(modules_)), metadata(std::move(metadata_)) { diff --git a/src/messages/MMgrClose.h b/src/messages/MMgrClose.h index d6b8415076b..6d35e9ba7b7 100644 --- a/src/messages/MMgrClose.h +++ b/src/messages/MMgrClose.h @@ -5,12 +5,8 @@ #include "msg/Message.h" -class MMgrClose : public Message -{ +class MMgrClose : public MessageInstance<MMgrClose> { public: - typedef boost::intrusive_ptr<MMgrClose> ref; - typedef boost::intrusive_ptr<MMgrClose const> const_ref; - using factory = MessageFactory<MMgrClose>; friend factory; private: @@ -47,6 +43,6 @@ public: } MMgrClose() - : Message(MSG_MGR_CLOSE, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_MGR_CLOSE, HEAD_VERSION, COMPAT_VERSION) {} }; diff --git a/src/messages/MMgrConfigure.h b/src/messages/MMgrConfigure.h index c65d01229c5..3f1ff9b00ab 100644 --- a/src/messages/MMgrConfigure.h +++ b/src/messages/MMgrConfigure.h @@ -21,12 +21,8 @@ * This message is sent from ceph-mgr to MgrClient, instructing it * it about what data to send back to ceph-mgr at what frequency. */ -class MMgrConfigure : public Message -{ +class MMgrConfigure : public MessageInstance<MMgrConfigure> { public: - typedef boost::intrusive_ptr<MMgrConfigure> ref; - typedef boost::intrusive_ptr<MMgrConfigure const> const_ref; - using factory = MessageFactory<MMgrConfigure>; friend factory; private: @@ -61,7 +57,7 @@ public: } MMgrConfigure() - : Message(MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_MGR_CONFIGURE, HEAD_VERSION, COMPAT_VERSION) {} }; diff --git a/src/messages/MMgrDigest.h b/src/messages/MMgrDigest.h index ad0863f36aa..949984b5800 100644 --- a/src/messages/MMgrDigest.h +++ b/src/messages/MMgrDigest.h @@ -22,18 +22,15 @@ * The mgr digest is a way for the mgr to subscribe to things * other than the cluster maps, which are needed by */ -class MMgrDigest : public Message { +class MMgrDigest : public MessageInstance<MMgrDigest> { public: - typedef boost::intrusive_ptr<MMgrDigest> ref; - typedef boost::intrusive_ptr<MMgrDigest const> const_ref; - using factory = MessageFactory<MMgrDigest>; friend factory; bufferlist mon_status_json; bufferlist health_json; MMgrDigest() : - Message(MSG_MGR_DIGEST) {} + MessageInstance(MSG_MGR_DIGEST) {} const char *get_type_name() const override { return "mgrdigest"; } void print(ostream& out) const override { diff --git a/src/messages/MMgrMap.h b/src/messages/MMgrMap.h index f15bba1bff0..af223b94b39 100644 --- a/src/messages/MMgrMap.h +++ b/src/messages/MMgrMap.h @@ -19,11 +19,8 @@ #include "msg/Message.h" #include "mon/MgrMap.h" -class MMgrMap : public Message { +class MMgrMap : public MessageInstance<MMgrMap> { public: - typedef boost::intrusive_ptr<MMgrMap> ref; - typedef boost::intrusive_ptr<MMgrMap const> const_ref; - using factory = MessageFactory<MMgrMap>; friend factory; protected: @@ -33,9 +30,9 @@ public: const MgrMap & get_map() {return map;} MMgrMap() : - Message(MSG_MGR_MAP) {} + MessageInstance(MSG_MGR_MAP) {} MMgrMap(const MgrMap &map_) : - Message(MSG_MGR_MAP), map(map_) + MessageInstance(MSG_MGR_MAP), map(map_) { } diff --git a/src/messages/MMgrOpen.h b/src/messages/MMgrOpen.h index 7db57a51d05..721668c4b52 100644 --- a/src/messages/MMgrOpen.h +++ b/src/messages/MMgrOpen.h @@ -17,12 +17,8 @@ #include "msg/Message.h" -class MMgrOpen : public Message -{ +class MMgrOpen : public MessageInstance<MMgrOpen> { public: - typedef boost::intrusive_ptr<MMgrOpen> ref; - typedef boost::intrusive_ptr<MMgrOpen const> const_ref; - using factory = MessageFactory<MMgrOpen>; friend factory; private: @@ -91,7 +87,7 @@ public: } MMgrOpen() - : Message(MSG_MGR_OPEN, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_MGR_OPEN, HEAD_VERSION, COMPAT_VERSION) {} }; diff --git a/src/messages/MMgrReport.h b/src/messages/MMgrReport.h index fdc46410519..232e97400de 100644 --- a/src/messages/MMgrReport.h +++ b/src/messages/MMgrReport.h @@ -70,12 +70,8 @@ public: }; WRITE_CLASS_ENCODER(PerfCounterType) -class MMgrReport : public Message -{ +class MMgrReport : public MessageInstance<MMgrReport> { public: - typedef boost::intrusive_ptr<MMgrReport> ref; - typedef boost::intrusive_ptr<MMgrReport const> const_ref; - using factory = MessageFactory<MMgrReport>; friend factory; private: @@ -164,7 +160,7 @@ public: } MMgrReport() - : Message(MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION) {} }; diff --git a/src/messages/MMonCommand.h b/src/messages/MMonCommand.h index f609c4bc849..7af8f8f919c 100644 --- a/src/messages/MMonCommand.h +++ b/src/messages/MMonCommand.h @@ -20,19 +20,16 @@ #include <vector> #include <string> -class MMonCommand : public PaxosServiceMessage { +class MMonCommand : public MessageInstance<MMonCommand, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonCommand> ref; - typedef boost::intrusive_ptr<MMonCommand const> const_ref; - using factory = MessageFactory<MMonCommand>; friend factory; uuid_d fsid; std::vector<std::string> cmd; - MMonCommand() : PaxosServiceMessage(MSG_MON_COMMAND, 0) {} + MMonCommand() : MessageInstance(MSG_MON_COMMAND, 0) {} MMonCommand(const uuid_d &f) - : PaxosServiceMessage(MSG_MON_COMMAND, 0), + : MessageInstance(MSG_MON_COMMAND, 0), fsid(f) { } diff --git a/src/messages/MMonCommandAck.h b/src/messages/MMonCommandAck.h index 4d2c442bca9..03fbdae63d7 100644 --- a/src/messages/MMonCommandAck.h +++ b/src/messages/MMonCommandAck.h @@ -17,20 +17,17 @@ #include "messages/PaxosServiceMessage.h" -class MMonCommandAck : public PaxosServiceMessage { +class MMonCommandAck : public MessageInstance<MMonCommandAck, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonCommandAck> ref; - typedef boost::intrusive_ptr<MMonCommandAck const> const_ref; - using factory = MessageFactory<MMonCommandAck>; friend factory; vector<string> cmd; errorcode32_t r; string rs; - MMonCommandAck() : PaxosServiceMessage(MSG_MON_COMMAND_ACK, 0) {} + MMonCommandAck() : MessageInstance(MSG_MON_COMMAND_ACK, 0) {} MMonCommandAck(vector<string>& c, int _r, string s, version_t v) : - PaxosServiceMessage(MSG_MON_COMMAND_ACK, v), + MessageInstance(MSG_MON_COMMAND_ACK, v), cmd(c), r(_r), rs(s) { } private: ~MMonCommandAck() override {} diff --git a/src/messages/MMonElection.h b/src/messages/MMonElection.h index ad15fe99853..2e838b0bf75 100644 --- a/src/messages/MMonElection.h +++ b/src/messages/MMonElection.h @@ -20,11 +20,8 @@ #include "mon/MonMap.h" #include "mon/mon_types.h" -class MMonElection : public Message { +class MMonElection : public MessageInstance<MMonElection> { public: - typedef boost::intrusive_ptr<MMonElection> ref; - typedef boost::intrusive_ptr<MMonElection const> const_ref; - using factory = MessageFactory<MMonElection>; friend factory; private: @@ -56,14 +53,14 @@ public: bufferlist sharing_bl; map<string,string> metadata; - MMonElection() : Message(MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION), + MMonElection() : MessageInstance(MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION), op(0), epoch(0), quorum_features(0), mon_features(0) { } MMonElection(int o, epoch_t e, MonMap *m) - : Message(MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MON_ELECTION, HEAD_VERSION, COMPAT_VERSION), fsid(m->fsid), op(o), epoch(e), quorum_features(0), mon_features(0) diff --git a/src/messages/MMonGetMap.h b/src/messages/MMonGetMap.h index eaae9d0b16a..a0713f7969c 100644 --- a/src/messages/MMonGetMap.h +++ b/src/messages/MMonGetMap.h @@ -19,14 +19,11 @@ #include "include/types.h" -class MMonGetMap : public Message { +class MMonGetMap : public MessageInstance<MMonGetMap> { public: - typedef boost::intrusive_ptr<MMonGetMap> ref; - typedef boost::intrusive_ptr<MMonGetMap const> const_ref; - using factory = MessageFactory<MMonGetMap>; friend factory; - MMonGetMap() : Message(CEPH_MSG_MON_GET_MAP) { } + MMonGetMap() : MessageInstance(CEPH_MSG_MON_GET_MAP) { } private: ~MMonGetMap() override {} diff --git a/src/messages/MMonGetOSDMap.h b/src/messages/MMonGetOSDMap.h index 5579c250a79..851b70fb645 100644 --- a/src/messages/MMonGetOSDMap.h +++ b/src/messages/MMonGetOSDMap.h @@ -19,11 +19,8 @@ #include "include/types.h" -class MMonGetOSDMap : public PaxosServiceMessage { +class MMonGetOSDMap : public MessageInstance<MMonGetOSDMap, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonGetOSDMap> ref; - typedef boost::intrusive_ptr<MMonGetOSDMap const> const_ref; - using factory = MessageFactory<MMonGetOSDMap>; friend factory; private: @@ -32,7 +29,7 @@ private: public: MMonGetOSDMap() - : PaxosServiceMessage(CEPH_MSG_MON_GET_OSDMAP, 0), + : MessageInstance(CEPH_MSG_MON_GET_OSDMAP, 0), full_first(0), full_last(0), inc_first(0), diff --git a/src/messages/MMonGetVersion.h b/src/messages/MMonGetVersion.h index 07faee88bf4..c8c892f2e35 100644 --- a/src/messages/MMonGetVersion.h +++ b/src/messages/MMonGetVersion.h @@ -25,14 +25,11 @@ * can be used to determine whether a pool actually does not exist, or * if it may have been created but the map was not received yet. */ -class MMonGetVersion : public Message { +class MMonGetVersion : public MessageInstance<MMonGetVersion> { public: - typedef boost::intrusive_ptr<MMonGetVersion> ref; - typedef boost::intrusive_ptr<MMonGetVersion const> const_ref; - using factory = MessageFactory<MMonGetVersion>; friend factory; - MMonGetVersion() : Message(CEPH_MSG_MON_GET_VERSION) {} + MMonGetVersion() : MessageInstance(CEPH_MSG_MON_GET_VERSION) {} const char *get_type_name() const override { return "mon_get_version"; diff --git a/src/messages/MMonGetVersionReply.h b/src/messages/MMonGetVersionReply.h index 2bc0fab7875..1eb3f567b33 100644 --- a/src/messages/MMonGetVersionReply.h +++ b/src/messages/MMonGetVersionReply.h @@ -24,17 +24,14 @@ * MMonGetVersion. The latest version of the requested thing is sent * back. */ -class MMonGetVersionReply : public Message { +class MMonGetVersionReply : public MessageInstance<MMonGetVersionReply> { public: - typedef boost::intrusive_ptr<MMonGetVersionReply> ref; - typedef boost::intrusive_ptr<MMonGetVersionReply const> const_ref; - using factory = MessageFactory<MMonGetVersionReply>; friend factory; private: static const int HEAD_VERSION = 2; public: - MMonGetVersionReply() : Message(CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION) { } + MMonGetVersionReply() : MessageInstance(CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION) { } const char *get_type_name() const override { return "mon_get_version_reply"; diff --git a/src/messages/MMonGlobalID.h b/src/messages/MMonGlobalID.h index 84db54bc418..51892b8f1dc 100644 --- a/src/messages/MMonGlobalID.h +++ b/src/messages/MMonGlobalID.h @@ -17,15 +17,12 @@ #include "messages/PaxosServiceMessage.h" -class MMonGlobalID : public PaxosServiceMessage { +class MMonGlobalID : public MessageInstance<MMonGlobalID, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonGlobalID> ref; - typedef boost::intrusive_ptr<MMonGlobalID const> const_ref; - using factory = MessageFactory<MMonGlobalID>; friend factory; uint64_t old_max_id; - MMonGlobalID() : PaxosServiceMessage(MSG_MON_GLOBAL_ID, 0), old_max_id(0) { } + MMonGlobalID() : MessageInstance(MSG_MON_GLOBAL_ID, 0), old_max_id(0) { } private: ~MMonGlobalID() override {} diff --git a/src/messages/MMonHealth.h b/src/messages/MMonHealth.h index 0443dca292c..393bb804046 100644 --- a/src/messages/MMonHealth.h +++ b/src/messages/MMonHealth.h @@ -18,11 +18,8 @@ #include "messages/MMonQuorumService.h" #include "mon/mon_types.h" -class MMonHealth : public MMonQuorumService { +class MMonHealth : public MessageInstance<MMonHealth, MMonQuorumService> { public: - typedef boost::intrusive_ptr<MMonHealth> ref; - typedef boost::intrusive_ptr<MMonHealth const> const_ref; - using factory = MessageFactory<MMonHealth>; friend factory; static const int HEAD_VERSION = 1; @@ -33,7 +30,7 @@ public: // service specific data DataStats data_stats; - MMonHealth() : MMonQuorumService(MSG_MON_HEALTH, HEAD_VERSION) { } + MMonHealth() : MessageInstance(MSG_MON_HEALTH, HEAD_VERSION) { } private: ~MMonHealth() override { } diff --git a/src/messages/MMonHealthChecks.h b/src/messages/MMonHealthChecks.h index 30962f601d3..eeb8bac23c6 100644 --- a/src/messages/MMonHealthChecks.h +++ b/src/messages/MMonHealthChecks.h @@ -7,11 +7,8 @@ #include "messages/PaxosServiceMessage.h" #include "mon/health_check.h" -class MMonHealthChecks : public PaxosServiceMessage { +class MMonHealthChecks : public MessageInstance<MMonHealthChecks, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonHealthChecks> ref; - typedef boost::intrusive_ptr<MMonHealthChecks const> const_ref; - using factory = MessageFactory<MMonHealthChecks>; friend factory; static const int HEAD_VERSION = 1; @@ -20,10 +17,10 @@ public: health_check_map_t health_checks; MMonHealthChecks() - : PaxosServiceMessage(MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION) { + : MessageInstance(MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION) { } MMonHealthChecks(health_check_map_t& m) - : PaxosServiceMessage(MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MON_HEALTH_CHECKS, HEAD_VERSION, COMPAT_VERSION), health_checks(m) { } diff --git a/src/messages/MMonJoin.h b/src/messages/MMonJoin.h index 597b1039f4c..8a65f27a830 100644 --- a/src/messages/MMonJoin.h +++ b/src/messages/MMonJoin.h @@ -20,20 +20,17 @@ #include <vector> using std::vector; -class MMonJoin : public PaxosServiceMessage { +class MMonJoin : public MessageInstance<MMonJoin, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonJoin> ref; - typedef boost::intrusive_ptr<MMonJoin const> const_ref; - using factory = MessageFactory<MMonJoin>; friend factory; uuid_d fsid; string name; entity_addr_t addr; - MMonJoin() : PaxosServiceMessage(MSG_MON_JOIN, 0) {} + MMonJoin() : MessageInstance(MSG_MON_JOIN, 0) {} MMonJoin(uuid_d &f, string n, const entity_addr_t& a) - : PaxosServiceMessage(MSG_MON_JOIN, 0), + : MessageInstance(MSG_MON_JOIN, 0), fsid(f), name(n), addr(a) { } diff --git a/src/messages/MMonMap.h b/src/messages/MMonMap.h index 8cd9c5d3f29..8bd21c863ca 100644 --- a/src/messages/MMonMap.h +++ b/src/messages/MMonMap.h @@ -19,17 +19,14 @@ #include "msg/Message.h" #include "mon/MonMap.h" -class MMonMap : public Message { +class MMonMap : public MessageInstance<MMonMap> { public: - typedef boost::intrusive_ptr<MMonMap> ref; - typedef boost::intrusive_ptr<MMonMap const> const_ref; - using factory = MessageFactory<MMonMap>; friend factory; bufferlist monmapbl; - MMonMap() : Message(CEPH_MSG_MON_MAP) { } - explicit MMonMap(bufferlist &bl) : Message(CEPH_MSG_MON_MAP) { + MMonMap() : MessageInstance(CEPH_MSG_MON_MAP) { } + explicit MMonMap(bufferlist &bl) : MessageInstance(CEPH_MSG_MON_MAP) { monmapbl.claim(bl); } private: diff --git a/src/messages/MMonMetadata.h b/src/messages/MMonMetadata.h index 1e50e43cd42..db6ffcd7db6 100644 --- a/src/messages/MMonMetadata.h +++ b/src/messages/MMonMetadata.h @@ -18,11 +18,8 @@ #include "mon/mon_types.h" #include "msg/Message.h" -class MMonMetadata : public Message { +class MMonMetadata : public MessageInstance<MMonMetadata> { public: - typedef boost::intrusive_ptr<MMonMetadata> ref; - typedef boost::intrusive_ptr<MMonMetadata const> const_ref; - using factory = MessageFactory<MMonMetadata>; friend factory; Metadata data; @@ -33,10 +30,10 @@ private: public: MMonMetadata() : - Message(CEPH_MSG_MON_METADATA) + MessageInstance(CEPH_MSG_MON_METADATA) {} MMonMetadata(const Metadata& metadata) : - Message(CEPH_MSG_MON_METADATA, HEAD_VERSION), + MessageInstance(CEPH_MSG_MON_METADATA, HEAD_VERSION), data(metadata) {} diff --git a/src/messages/MMonMgrReport.h b/src/messages/MMonMgrReport.h index 81464ff61b3..85277492a4d 100644 --- a/src/messages/MMonMgrReport.h +++ b/src/messages/MMonMgrReport.h @@ -20,11 +20,8 @@ #include "include/health.h" #include "mon/health_check.h" -class MMonMgrReport : public PaxosServiceMessage { +class MMonMgrReport : public MessageInstance<MMonMgrReport, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MMonMgrReport> ref; - typedef boost::intrusive_ptr<MMonMgrReport const> const_ref; - using factory = MessageFactory<MMonMgrReport>; friend factory; private: static const int HEAD_VERSION = 1; @@ -36,7 +33,7 @@ public: bufferlist service_map_bl; // encoded ServiceMap MMonMgrReport() - : PaxosServiceMessage(MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_MON_MGR_REPORT, 0, HEAD_VERSION, COMPAT_VERSION) {} private: ~MMonMgrReport() override {} diff --git a/src/messages/MMonPaxos.h b/src/messages/MMonPaxos.h index a872f7ac366..56ab8c5c015 100644 --- a/src/messages/MMonPaxos.h +++ b/src/messages/MMonPaxos.h @@ -20,11 +20,8 @@ #include "mon/mon_types.h" #include "include/ceph_features.h" -class MMonPaxos : public Message { +class MMonPaxos : public MessageInstance<MMonPaxos> { public: - typedef boost::intrusive_ptr<MMonPaxos> ref; - typedef boost::intrusive_ptr<MMonPaxos const> const_ref; - using factory = MessageFactory<MMonPaxos>; friend factory; private: static const int HEAD_VERSION = 4; @@ -70,9 +67,9 @@ private: bufferlist feature_map; - MMonPaxos() : Message(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION) { } + MMonPaxos() : MessageInstance(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION) { } MMonPaxos(epoch_t e, int o, utime_t now) : - Message(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_MON_PAXOS, HEAD_VERSION, COMPAT_VERSION), epoch(e), op(o), first_committed(0), last_committed(0), pn_from(0), pn(0), uncommitted_pn(0), diff --git a/src/messages/MMonProbe.h b/src/messages/MMonProbe.h index 6709a26031a..2ee68de71e9 100644 --- a/src/messages/MMonProbe.h +++ b/src/messages/MMonProbe.h @@ -20,11 +20,8 @@ #include "msg/Message.h" #include "mon/MonMap.h" -class MMonProbe : public Message { +class MMonProbe : public MessageInstance<MMonProbe> { public: - typedef boost::intrusive_ptr<MMonProbe> ref; - typedef boost::intrusive_ptr<MMonProbe const> const_ref; - using factory = MessageFactory<MMonProbe>; friend factory; static const int HEAD_VERSION = 6; @@ -62,9 +59,9 @@ public: uint64_t required_features = 0; MMonProbe() - : Message(MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION) {} MMonProbe(const uuid_d& f, int o, const string& n, bool hej) - : Message(MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MON_PROBE, HEAD_VERSION, COMPAT_VERSION), fsid(f), op(o), name(n), diff --git a/src/messages/MMonQuorumService.h b/src/messages/MMonQuorumService.h index be09e54b833..068849875b7 100644 --- a/src/messages/MMonQuorumService.h +++ b/src/messages/MMonQuorumService.h @@ -16,23 +16,15 @@ #include "msg/Message.h" -class MMonQuorumService : public Message { +class MMonQuorumService : public MessageSubType<MMonQuorumService> { public: - typedef boost::intrusive_ptr<MMonQuorumService> ref; - typedef boost::intrusive_ptr<MMonQuorumService const> const_ref; - using factory = MessageFactory<MMonQuorumService>; - friend factory; - - epoch_t epoch; - version_t round; - - MMonQuorumService(int type, int head=1, int compat=1) : - Message(type, head, compat), - epoch(0), - round(0) - { } + epoch_t epoch = 0; + version_t round = 0; protected: +template<typename... Args> + MMonQuorumService(Args&&... args) : MessageSubType(std::forward<Args>(args)...) {} + ~MMonQuorumService() override { } public: diff --git a/src/messages/MMonScrub.h b/src/messages/MMonScrub.h index 5a7936965a8..023fbdcd9d3 100644 --- a/src/messages/MMonScrub.h +++ b/src/messages/MMonScrub.h @@ -16,11 +16,8 @@ #include "msg/Message.h" #include "mon/mon_types.h" -class MMonScrub : public Message { +class MMonScrub : public MessageInstance<MMonScrub> { public: - typedef boost::intrusive_ptr<MMonScrub> ref; - typedef boost::intrusive_ptr<MMonScrub const> const_ref; - using factory = MessageFactory<MMonScrub>; friend factory; private: static const int HEAD_VERSION = 2; @@ -47,12 +44,12 @@ public: pair<string,string> key; MMonScrub() - : Message(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION), num_keys(-1) { } MMonScrub(op_type_t op, version_t v, int32_t num_keys) - : Message(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MON_SCRUB, HEAD_VERSION, COMPAT_VERSION), op(op), version(v), num_keys(num_keys) { } diff --git a/src/messages/MMonSubscribe.h b/src/messages/MMonSubscribe.h index 32dc5429cea..bce11d3fc6a 100644 --- a/src/messages/MMonSubscribe.h +++ b/src/messages/MMonSubscribe.h @@ -29,11 +29,8 @@ struct ceph_mon_subscribe_item_old { WRITE_RAW_ENCODER(ceph_mon_subscribe_item_old) -class MMonSubscribe : public Message { +class MMonSubscribe : public MessageInstance<MMonSubscribe> { public: - typedef boost::intrusive_ptr<MMonSubscribe> ref; - typedef boost::intrusive_ptr<MMonSubscribe const> const_ref; - using factory = MessageFactory<MMonSubscribe>; friend factory; static const int HEAD_VERSION = 3; @@ -42,7 +39,7 @@ public: string hostname; map<string, ceph_mon_subscribe_item> what; - MMonSubscribe() : Message(CEPH_MSG_MON_SUBSCRIBE, HEAD_VERSION, COMPAT_VERSION) { } + MMonSubscribe() : MessageInstance(CEPH_MSG_MON_SUBSCRIBE, HEAD_VERSION, COMPAT_VERSION) { } private: ~MMonSubscribe() override {} diff --git a/src/messages/MMonSubscribeAck.h b/src/messages/MMonSubscribeAck.h index 35681cb932a..c16cbf3b2f9 100644 --- a/src/messages/MMonSubscribeAck.h +++ b/src/messages/MMonSubscribeAck.h @@ -17,20 +17,17 @@ #include "msg/Message.h" -class MMonSubscribeAck : public Message { +class MMonSubscribeAck : public MessageInstance<MMonSubscribeAck> { public: - typedef boost::intrusive_ptr<MMonSubscribeAck> ref; - typedef boost::intrusive_ptr<MMonSubscribeAck const> const_ref; - using factory = MessageFactory<MMonSubscribeAck>; friend factory; __u32 interval; uuid_d fsid; - MMonSubscribeAck() : Message(CEPH_MSG_MON_SUBSCRIBE_ACK), + MMonSubscribeAck() : MessageInstance(CEPH_MSG_MON_SUBSCRIBE_ACK), interval(0) { } - MMonSubscribeAck(uuid_d& f, int i) : Message(CEPH_MSG_MON_SUBSCRIBE_ACK), + MMonSubscribeAck(uuid_d& f, int i) : MessageInstance(CEPH_MSG_MON_SUBSCRIBE_ACK), interval(i), fsid(f) { } private: ~MMonSubscribeAck() override {} diff --git a/src/messages/MMonSync.h b/src/messages/MMonSync.h index 8e5ae95a2f4..c7c9d20d5e1 100644 --- a/src/messages/MMonSync.h +++ b/src/messages/MMonSync.h @@ -15,11 +15,8 @@ #include "msg/Message.h" -class MMonSync : public Message { +class MMonSync : public MessageInstance<MMonSync> { public: - typedef boost::intrusive_ptr<MMonSync> ref; - typedef boost::intrusive_ptr<MMonSync const> const_ref; - using factory = MessageFactory<MMonSync>; friend factory; private: static const int HEAD_VERSION = 2; @@ -66,11 +63,11 @@ public: entity_inst_t reply_to; MMonSync() - : Message(MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION) { } MMonSync(uint32_t op, uint64_t c = 0) - : Message(MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_MON_SYNC, HEAD_VERSION, COMPAT_VERSION), op(op), cookie(c), last_committed(0) diff --git a/src/messages/MNop.h b/src/messages/MNop.h index f59816d0b67..73f778cebd9 100644 --- a/src/messages/MNop.h +++ b/src/messages/MNop.h @@ -22,11 +22,8 @@ /* * A message with no (remote) effect. */ -class MNop : public Message { +class MNop : public MessageInstance<MNop> { public: - typedef boost::intrusive_ptr<MNop> ref; - typedef boost::intrusive_ptr<MNop const> const_ref; - using factory = MessageFactory<MNop>; friend factory; static const int HEAD_VERSION = 1; @@ -35,7 +32,7 @@ public: __u32 tag; // ignored tag value MNop() - : Message(MSG_NOP, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_NOP, HEAD_VERSION, COMPAT_VERSION) {} ~MNop() {} diff --git a/src/messages/MOSDAlive.h b/src/messages/MOSDAlive.h index 5e868add140..4e1f15e33ba 100644 --- a/src/messages/MOSDAlive.h +++ b/src/messages/MOSDAlive.h @@ -19,17 +19,14 @@ #include "messages/PaxosServiceMessage.h" -class MOSDAlive : public PaxosServiceMessage { +class MOSDAlive : public MessageInstance<MOSDAlive, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDAlive> ref; - typedef boost::intrusive_ptr<MOSDAlive const> const_ref; - using factory = MessageFactory<MOSDAlive>; friend factory; epoch_t want = 0; - MOSDAlive(epoch_t h, epoch_t w) : PaxosServiceMessage(MSG_OSD_ALIVE, h), want(w) { } - MOSDAlive() : PaxosServiceMessage(MSG_OSD_ALIVE, 0) {} + MOSDAlive(epoch_t h, epoch_t w) : MessageInstance(MSG_OSD_ALIVE, h), want(w) { } + MOSDAlive() : MessageInstance(MSG_OSD_ALIVE, 0) {} private: ~MOSDAlive() override {} diff --git a/src/messages/MOSDBackoff.h b/src/messages/MOSDBackoff.h index 1b2e511629b..ebff1812ebc 100644 --- a/src/messages/MOSDBackoff.h +++ b/src/messages/MOSDBackoff.h @@ -19,11 +19,8 @@ #include "MOSDFastDispatchOp.h" #include "osd/osd_types.h" -class MOSDBackoff : public MOSDFastDispatchOp { +class MOSDBackoff : public MessageInstance<MOSDBackoff, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDBackoff> ref; - typedef boost::intrusive_ptr<MOSDBackoff const> const_ref; - using factory = MessageFactory<MOSDBackoff>; friend factory; static constexpr int HEAD_VERSION = 1; @@ -43,10 +40,10 @@ public: } MOSDBackoff() - : MOSDFastDispatchOp(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION) {} MOSDBackoff(spg_t pgid_, epoch_t ep, uint8_t op_, uint64_t id_, hobject_t begin_, hobject_t end_) - : MOSDFastDispatchOp(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_OSD_BACKOFF, HEAD_VERSION, COMPAT_VERSION), pgid(pgid_), map_epoch(ep), op(op_), diff --git a/src/messages/MOSDBeacon.h b/src/messages/MOSDBeacon.h index ff79842867b..3433c2379a9 100644 --- a/src/messages/MOSDBeacon.h +++ b/src/messages/MOSDBeacon.h @@ -3,21 +3,18 @@ #pragma once -class MOSDBeacon : public PaxosServiceMessage { +class MOSDBeacon : public MessageInstance<MOSDBeacon, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDBeacon> ref; - typedef boost::intrusive_ptr<MOSDBeacon const> const_ref; - using factory = MessageFactory<MOSDBeacon>; friend factory; std::vector<pg_t> pgs; epoch_t min_last_epoch_clean = 0; MOSDBeacon() - : PaxosServiceMessage(MSG_OSD_BEACON, 0) + : MessageInstance(MSG_OSD_BEACON, 0) {} MOSDBeacon(epoch_t e, epoch_t min_lec) - : PaxosServiceMessage(MSG_OSD_BEACON, e), + : MessageInstance(MSG_OSD_BEACON, e), min_last_epoch_clean(min_lec) {} void encode_payload(uint64_t features) override { diff --git a/src/messages/MOSDBoot.h b/src/messages/MOSDBoot.h index 475d889cc0e..a76b07a4caf 100644 --- a/src/messages/MOSDBoot.h +++ b/src/messages/MOSDBoot.h @@ -20,11 +20,8 @@ #include "include/types.h" #include "osd/osd_types.h" -class MOSDBoot : public PaxosServiceMessage { +class MOSDBoot : public MessageInstance<MOSDBoot, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDBoot> ref; - typedef boost::intrusive_ptr<MOSDBoot const> const_ref; - using factory = MessageFactory<MOSDBoot>; friend factory; private: static const int HEAD_VERSION = 6; @@ -39,7 +36,7 @@ private: uint64_t osd_features; MOSDBoot() - : PaxosServiceMessage(MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_BOOT, 0, HEAD_VERSION, COMPAT_VERSION), boot_epoch(0), osd_features(0) { } MOSDBoot(OSDSuperblock& s, epoch_t e, epoch_t be, @@ -47,7 +44,7 @@ private: const entity_addrvec_t& hb_front_addr_ref, const entity_addrvec_t& cluster_addr_ref, uint64_t feat) - : PaxosServiceMessage(MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_BOOT, e, HEAD_VERSION, COMPAT_VERSION), sb(s), hb_back_addrs(hb_back_addr_ref), hb_front_addrs(hb_front_addr_ref), diff --git a/src/messages/MOSDECSubOpRead.h b/src/messages/MOSDECSubOpRead.h index 62215378179..e1cdb78e06c 100644 --- a/src/messages/MOSDECSubOpRead.h +++ b/src/messages/MOSDECSubOpRead.h @@ -18,11 +18,8 @@ #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpRead : public MOSDFastDispatchOp { +class MOSDECSubOpRead : public MessageInstance<MOSDECSubOpRead, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDECSubOpRead> ref; - typedef boost::intrusive_ptr<MOSDECSubOpRead const> const_ref; - using factory = MessageFactory<MOSDECSubOpRead>; friend factory; private: static const int HEAD_VERSION = 3; @@ -47,7 +44,7 @@ public: } MOSDECSubOpRead() - : MOSDFastDispatchOp(MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_OSD_EC_READ, HEAD_VERSION, COMPAT_VERSION) {} void decode_payload() override { diff --git a/src/messages/MOSDECSubOpReadReply.h b/src/messages/MOSDECSubOpReadReply.h index 6dc46a89219..6cdc9d60e49 100644 --- a/src/messages/MOSDECSubOpReadReply.h +++ b/src/messages/MOSDECSubOpReadReply.h @@ -18,11 +18,8 @@ #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpReadReply : public MOSDFastDispatchOp { +class MOSDECSubOpReadReply : public MessageInstance<MOSDECSubOpReadReply, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDECSubOpReadReply> ref; - typedef boost::intrusive_ptr<MOSDECSubOpReadReply const> const_ref; - using factory = MessageFactory<MOSDECSubOpReadReply>; friend factory; private: static const int HEAD_VERSION = 2; @@ -47,7 +44,7 @@ public: } MOSDECSubOpReadReply() - : MOSDFastDispatchOp(MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_OSD_EC_READ_REPLY, HEAD_VERSION, COMPAT_VERSION) {} void decode_payload() override { diff --git a/src/messages/MOSDECSubOpWrite.h b/src/messages/MOSDECSubOpWrite.h index 7fc55b62b6e..7a5c382293e 100644 --- a/src/messages/MOSDECSubOpWrite.h +++ b/src/messages/MOSDECSubOpWrite.h @@ -18,11 +18,8 @@ #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpWrite : public MOSDFastDispatchOp { +class MOSDECSubOpWrite : public MessageInstance<MOSDECSubOpWrite, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDECSubOpWrite> ref; - typedef boost::intrusive_ptr<MOSDECSubOpWrite const> const_ref; - using factory = MessageFactory<MOSDECSubOpWrite>; friend factory; private: static const int HEAD_VERSION = 2; @@ -47,10 +44,10 @@ public: } MOSDECSubOpWrite() - : MOSDFastDispatchOp(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) {} MOSDECSubOpWrite(ECSubWrite &in_op) - : MOSDFastDispatchOp(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) { + : MessageInstance(MSG_OSD_EC_WRITE, HEAD_VERSION, COMPAT_VERSION) { op.claim(in_op); } diff --git a/src/messages/MOSDECSubOpWriteReply.h b/src/messages/MOSDECSubOpWriteReply.h index e07dca836ce..dea3c501f8c 100644 --- a/src/messages/MOSDECSubOpWriteReply.h +++ b/src/messages/MOSDECSubOpWriteReply.h @@ -18,11 +18,8 @@ #include "MOSDFastDispatchOp.h" #include "osd/ECMsgTypes.h" -class MOSDECSubOpWriteReply : public MOSDFastDispatchOp { +class MOSDECSubOpWriteReply : public MessageInstance<MOSDECSubOpWriteReply, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDECSubOpWriteReply> ref; - typedef boost::intrusive_ptr<MOSDECSubOpWriteReply const> const_ref; - using factory = MessageFactory<MOSDECSubOpWriteReply>; friend factory; private: static const int HEAD_VERSION = 2; @@ -47,7 +44,7 @@ public: } MOSDECSubOpWriteReply() - : MOSDFastDispatchOp(MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION) + : MessageInstance(MSG_OSD_EC_WRITE_REPLY, HEAD_VERSION, COMPAT_VERSION) {} void decode_payload() override { diff --git a/src/messages/MOSDFailure.h b/src/messages/MOSDFailure.h index 37d70af341c..29516e06b50 100644 --- a/src/messages/MOSDFailure.h +++ b/src/messages/MOSDFailure.h @@ -19,11 +19,8 @@ #include "messages/PaxosServiceMessage.h" -class MOSDFailure : public PaxosServiceMessage { +class MOSDFailure : public MessageInstance<MOSDFailure, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDFailure> ref; - typedef boost::intrusive_ptr<MOSDFailure const> const_ref; - using factory = MessageFactory<MOSDFailure>; friend factory; private: static const int HEAD_VERSION = 4; @@ -43,10 +40,10 @@ private: epoch_t epoch = 0; int32_t failed_for = 0; // known to be failed since at least this long - MOSDFailure() : PaxosServiceMessage(MSG_OSD_FAILURE, 0, HEAD_VERSION) { } + MOSDFailure() : MessageInstance(MSG_OSD_FAILURE, 0, HEAD_VERSION) { } MOSDFailure(const uuid_d &fs, int osd, const entity_addrvec_t& av, int duration, epoch_t e) - : PaxosServiceMessage(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION), fsid(fs), target_osd(osd), target_addrs(av), @@ -55,7 +52,7 @@ private: MOSDFailure(const uuid_d &fs, int osd, const entity_addrvec_t& av, int duration, epoch_t e, __u8 extra_flags) - : PaxosServiceMessage(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_FAILURE, e, HEAD_VERSION, COMPAT_VERSION), fsid(fs), target_osd(osd), target_addrs(av), diff --git a/src/messages/MOSDFastDispatchOp.h b/src/messages/MOSDFastDispatchOp.h index 3ba555f8929..1f5f7abe223 100644 --- a/src/messages/MOSDFastDispatchOp.h +++ b/src/messages/MOSDFastDispatchOp.h @@ -7,21 +7,17 @@ #include "msg/Message.h" #include "osd/osd_types.h" -class MOSDFastDispatchOp : public Message { +class MOSDFastDispatchOp : public MessageSubType<MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDFastDispatchOp> ref; - typedef boost::intrusive_ptr<MOSDFastDispatchOp const> const_ref; - using factory = MessageFactory<MOSDFastDispatchOp>; - friend factory; + +template<typename... Args> + MOSDFastDispatchOp(Args&&... args) : MessageSubType(std::forward<Args>(args)...) {} virtual epoch_t get_map_epoch() const = 0; virtual epoch_t get_min_epoch() const { return get_map_epoch(); } virtual spg_t get_spg() const = 0; - - MOSDFastDispatchOp(int t, int version, int compat_version) - : Message(t, version, compat_version) {} }; #endif diff --git a/src/messages/MOSDForceRecovery.h b/src/messages/MOSDForceRecovery.h index 06e47ea3ce4..2a5b37f2443 100644 --- a/src/messages/MOSDForceRecovery.h +++ b/src/messages/MOSDForceRecovery.h @@ -31,11 +31,8 @@ static const int OFR_BACKFILL = 2; // cancel priority boost, requeue if necessary static const int OFR_CANCEL = 4; -class MOSDForceRecovery : public Message { +class MOSDForceRecovery : public MessageInstance<MOSDForceRecovery> { public: - typedef boost::intrusive_ptr<MOSDForceRecovery> ref; - typedef boost::intrusive_ptr<MOSDForceRecovery const> const_ref; - using factory = MessageFactory<MOSDForceRecovery>; friend factory; static const int HEAD_VERSION = 2; @@ -45,12 +42,12 @@ public: vector<spg_t> forced_pgs; uint8_t options = 0; - MOSDForceRecovery() : Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION) {} + MOSDForceRecovery() : MessageInstance(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION) {} MOSDForceRecovery(const uuid_d& f, char opts) : - Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION), fsid(f), options(opts) {} MOSDForceRecovery(const uuid_d& f, vector<spg_t>& pgs, char opts) : - Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION), fsid(f), forced_pgs(pgs), options(opts) {} private: ~MOSDForceRecovery() {} diff --git a/src/messages/MOSDFull.h b/src/messages/MOSDFull.h index 6573aa3101c..9adb32153e3 100644 --- a/src/messages/MOSDFull.h +++ b/src/messages/MOSDFull.h @@ -11,11 +11,8 @@ // future this message could be generalized to other state bits, but // for now name it for its sole application. -class MOSDFull : public PaxosServiceMessage { +class MOSDFull : public MessageInstance<MOSDFull, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDFull> ref; - typedef boost::intrusive_ptr<MOSDFull const> const_ref; - using factory = MessageFactory<MOSDFull>; friend factory; epoch_t map_epoch = 0; @@ -26,9 +23,9 @@ private: public: MOSDFull(epoch_t e, unsigned s) - : PaxosServiceMessage(MSG_OSD_FULL, e), map_epoch(e), state(s) { } + : MessageInstance(MSG_OSD_FULL, e), map_epoch(e), state(s) { } MOSDFull() - : PaxosServiceMessage(MSG_OSD_FULL, 0) {} + : MessageInstance(MSG_OSD_FULL, 0) {} public: void encode_payload(uint64_t features) { diff --git a/src/messages/MOSDMap.h b/src/messages/MOSDMap.h index f0149650b28..7ff35ba79ef 100644 --- a/src/messages/MOSDMap.h +++ b/src/messages/MOSDMap.h @@ -20,11 +20,8 @@ #include "osd/OSDMap.h" #include "include/ceph_features.h" -class MOSDMap : public Message { +class MOSDMap : public MessageInstance<MOSDMap> { public: - typedef boost::intrusive_ptr<MOSDMap> ref; - typedef boost::intrusive_ptr<MOSDMap const> const_ref; - using factory = MessageFactory<MOSDMap>; friend factory; private: static const int HEAD_VERSION = 4; @@ -68,9 +65,9 @@ private: } - MOSDMap() : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION) { } + MOSDMap() : MessageInstance(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION) { } MOSDMap(const uuid_d &f, const uint64_t features) - : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION), fsid(f), encode_features(features), oldest_map(0), newest_map(0) { } private: diff --git a/src/messages/MOSDMarkMeDown.h b/src/messages/MOSDMarkMeDown.h index faa360760b0..ce773fae32d 100644 --- a/src/messages/MOSDMarkMeDown.h +++ b/src/messages/MOSDMarkMeDown.h @@ -17,11 +17,8 @@ #include "messages/PaxosServiceMessage.h" -class MOSDMarkMeDown : public PaxosServiceMessage { +class MOSDMarkMeDown : public MessageInstance<MOSDMarkMeDown, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDMarkMeDown> ref; - typedef boost::intrusive_ptr<MOSDMarkMeDown const> const_ref; - using factory = MessageFactory<MOSDMarkMeDown>; friend factory; private: static const int HEAD_VERSION = 3; @@ -35,11 +32,11 @@ private: bool request_ack = false; // ack requested MOSDMarkMeDown() - : PaxosServiceMessage(MSG_OSD_MARK_ME_DOWN, 0, + : MessageInstance(MSG_OSD_MARK_ME_DOWN, 0, HEAD_VERSION, COMPAT_VERSION) { } MOSDMarkMeDown(const uuid_d &fs, int osd, const entity_addrvec_t& av, epoch_t e, bool request_ack) - : PaxosServiceMessage(MSG_OSD_MARK_ME_DOWN, e, + : MessageInstance(MSG_OSD_MARK_ME_DOWN, e, HEAD_VERSION, COMPAT_VERSION), fsid(fs), target_osd(osd), target_addrs(av), epoch(e), request_ack(request_ack) {} diff --git a/src/messages/MOSDOp.h b/src/messages/MOSDOp.h index 30e11ceee69..2dd0931248b 100644 --- a/src/messages/MOSDOp.h +++ b/src/messages/MOSDOp.h @@ -31,11 +31,8 @@ class OSD; -class MOSDOp : public MOSDFastDispatchOp { +class MOSDOp : public MessageInstance<MOSDOp, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDOp> ref; - typedef boost::intrusive_ptr<MOSDOp const> const_ref; - using factory = MessageFactory<MOSDOp>; friend factory; private: static const int HEAD_VERSION = 8; @@ -172,14 +169,14 @@ public: } MOSDOp() - : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), partial_decode_needed(true), final_decode_needed(true), bdata_encode(false) { } MOSDOp(int inc, long tid, const hobject_t& ho, spg_t& _pgid, epoch_t _osdmap_epoch, int _flags, uint64_t feat) - : MOSDFastDispatchOp(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_OSD_OP, HEAD_VERSION, COMPAT_VERSION), client_inc(inc), osdmap_epoch(_osdmap_epoch), flags(_flags), retry_attempt(-1), hobj(ho), diff --git a/src/messages/MOSDOpReply.h b/src/messages/MOSDOpReply.h index b4dc9d8595f..21422dd2f48 100644 --- a/src/messages/MOSDOpReply.h +++ b/src/messages/MOSDOpReply.h @@ -30,11 +30,8 @@ * */ -class MOSDOpReply : public Message { +class MOSDOpReply : public MessageInstance<MOSDOpReply> { public: - typedef boost::intrusive_ptr<MOSDOpReply> ref; - typedef boost::intrusive_ptr<MOSDOpReply const> const_ref; - using factory = MessageFactory<MOSDOpReply>; friend factory; private: static const int HEAD_VERSION = 8; @@ -132,13 +129,13 @@ public: public: MOSDOpReply() - : Message(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION), bdata_encode(false) { do_redirect = false; } MOSDOpReply(const MOSDOp *req, int r, epoch_t e, int acktype, bool ignore_out_data) - : Message(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_OSD_OPREPLY, HEAD_VERSION, COMPAT_VERSION), oid(req->hobj.oid), pgid(req->pgid.pgid), ops(req->ops), bdata_encode(false) { diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h index 849a0bc7f1f..e57a38ccd53 100644 --- a/src/messages/MOSDPGBackfill.h +++ b/src/messages/MOSDPGBackfill.h @@ -17,11 +17,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGBackfill : public MOSDFastDispatchOp { +class MOSDPGBackfill : public MessageInstance<MOSDPGBackfill, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGBackfill> ref; - typedef boost::intrusive_ptr<MOSDPGBackfill const> const_ref; - using factory = MessageFactory<MOSDPGBackfill>; friend factory; private: static const int HEAD_VERSION = 3; @@ -94,9 +91,9 @@ public: } MOSDPGBackfill() - : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGBackfill(__u32 o, epoch_t e, epoch_t qe, spg_t p) - : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), op(o), map_epoch(e), query_epoch(e), pgid(p) {} diff --git a/src/messages/MOSDPGBackfillRemove.h b/src/messages/MOSDPGBackfillRemove.h index 0c10e9409dc..3f39f762900 100644 --- a/src/messages/MOSDPGBackfillRemove.h +++ b/src/messages/MOSDPGBackfillRemove.h @@ -21,11 +21,8 @@ * instruct non-primary to remove some objects during backfill */ -class MOSDPGBackfillRemove : public MOSDFastDispatchOp { +class MOSDPGBackfillRemove : public MessageInstance<MOSDPGBackfillRemove, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGBackfillRemove> ref; - typedef boost::intrusive_ptr<MOSDPGBackfillRemove const> const_ref; - using factory = MessageFactory<MOSDPGBackfillRemove>; friend factory; static const int HEAD_VERSION = 1; @@ -43,11 +40,11 @@ public: } MOSDPGBackfillRemove() - : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION, + : MessageInstance(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGBackfillRemove(spg_t pgid, epoch_t map_epoch) - : MOSDFastDispatchOp(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION, + : MessageInstance(MSG_OSD_PG_BACKFILL_REMOVE, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), map_epoch(map_epoch) {} diff --git a/src/messages/MOSDPGCreate.h b/src/messages/MOSDPGCreate.h index 7384c4f499e..c1380af5f79 100644 --- a/src/messages/MOSDPGCreate.h +++ b/src/messages/MOSDPGCreate.h @@ -23,11 +23,8 @@ * PGCreate - instruct an OSD to create a pg, if it doesn't already exist */ -class MOSDPGCreate : public Message { +class MOSDPGCreate : public MessageInstance<MOSDPGCreate> { public: - typedef boost::intrusive_ptr<MOSDPGCreate> ref; - typedef boost::intrusive_ptr<MOSDPGCreate const> const_ref; - using factory = MessageFactory<MOSDPGCreate>; friend factory; const static int HEAD_VERSION = 3; @@ -38,9 +35,9 @@ public: map<pg_t,utime_t> ctimes; MOSDPGCreate() - : Message(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGCreate(epoch_t e) - : Message(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION), epoch(e) { } private: ~MOSDPGCreate() override {} diff --git a/src/messages/MOSDPGCreate2.h b/src/messages/MOSDPGCreate2.h index 6b2694b7d11..83cfc28ebe7 100644 --- a/src/messages/MOSDPGCreate2.h +++ b/src/messages/MOSDPGCreate2.h @@ -10,11 +10,8 @@ * PGCreate2 - instruct an OSD to create some pgs */ -class MOSDPGCreate2 : public Message { +class MOSDPGCreate2 : public MessageInstance<MOSDPGCreate2> { public: - typedef boost::intrusive_ptr<MOSDPGCreate2> ref; - typedef boost::intrusive_ptr<MOSDPGCreate2 const> const_ref; - using factory = MessageFactory<MOSDPGCreate2>; friend factory; const static int HEAD_VERSION = 1; @@ -24,9 +21,9 @@ public: map<spg_t,pair<epoch_t,utime_t>> pgs; MOSDPGCreate2() - : Message(MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGCreate2(epoch_t e) - : Message(MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_CREATE2, HEAD_VERSION, COMPAT_VERSION), epoch(e) { } private: ~MOSDPGCreate2() override {} diff --git a/src/messages/MOSDPGCreated.h b/src/messages/MOSDPGCreated.h index 50ad405efe8..cb411df3423 100644 --- a/src/messages/MOSDPGCreated.h +++ b/src/messages/MOSDPGCreated.h @@ -6,19 +6,16 @@ #include "osd/osd_types.h" #include "messages/PaxosServiceMessage.h" -class MOSDPGCreated : public PaxosServiceMessage { +class MOSDPGCreated : public MessageInstance<MOSDPGCreated, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDPGCreated> ref; - typedef boost::intrusive_ptr<MOSDPGCreated const> const_ref; - using factory = MessageFactory<MOSDPGCreated>; friend factory; pg_t pgid; MOSDPGCreated() - : PaxosServiceMessage(MSG_OSD_PG_CREATED, 0) + : MessageInstance(MSG_OSD_PG_CREATED, 0) {} MOSDPGCreated(pg_t pgid) - : PaxosServiceMessage(MSG_OSD_PG_CREATED, 0), + : MessageInstance(MSG_OSD_PG_CREATED, 0), pgid(pgid) {} const char *get_type_name() const override { return "pg_created"; } diff --git a/src/messages/MOSDPGInfo.h b/src/messages/MOSDPGInfo.h index 48980ce1941..336a61d5b6b 100644 --- a/src/messages/MOSDPGInfo.h +++ b/src/messages/MOSDPGInfo.h @@ -19,11 +19,8 @@ #include "msg/Message.h" #include "osd/osd_types.h" -class MOSDPGInfo : public Message { +class MOSDPGInfo : public MessageInstance<MOSDPGInfo> { public: - typedef boost::intrusive_ptr<MOSDPGInfo> ref; - typedef boost::intrusive_ptr<MOSDPGInfo const> const_ref; - using factory = MessageFactory<MOSDPGInfo>; friend factory; private: static const int HEAD_VERSION = 5; @@ -37,11 +34,11 @@ public: epoch_t get_epoch() const { return epoch; } MOSDPGInfo() - : Message(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION) { + : MessageInstance(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION) { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGInfo(version_t mv) - : Message(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_INFO, HEAD_VERSION, COMPAT_VERSION), epoch(mv) { set_priority(CEPH_MSG_PRIO_HIGH); } diff --git a/src/messages/MOSDPGLog.h b/src/messages/MOSDPGLog.h index 9813db344c9..4025c8f0d55 100644 --- a/src/messages/MOSDPGLog.h +++ b/src/messages/MOSDPGLog.h @@ -18,11 +18,8 @@ #include "messages/MOSDPeeringOp.h" -class MOSDPGLog : public MOSDPeeringOp { +class MOSDPGLog : public MessageInstance<MOSDPGLog, MOSDPeeringOp> { public: - typedef boost::intrusive_ptr<MOSDPGLog> ref; - typedef boost::intrusive_ptr<MOSDPGLog const> const_ref; - using factory = MessageFactory<MOSDPGLog>; friend factory; private: static const int HEAD_VERSION = 5; @@ -71,12 +68,12 @@ public: false)); } - MOSDPGLog() : MOSDPeeringOp(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION) { + MOSDPGLog() : MessageInstance(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION) { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGLog(shard_id_t to, shard_id_t from, version_t mv, pg_info_t& i, epoch_t query_epoch) - : MOSDPeeringOp(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION), epoch(mv), query_epoch(query_epoch), to(to), from(from), info(i) { diff --git a/src/messages/MOSDPGNotify.h b/src/messages/MOSDPGNotify.h index b5235ff9e2e..5cbf6569bc9 100644 --- a/src/messages/MOSDPGNotify.h +++ b/src/messages/MOSDPGNotify.h @@ -23,11 +23,8 @@ * PGNotify - notify primary of my PGs and versions. */ -class MOSDPGNotify : public Message { +class MOSDPGNotify : public MessageInstance<MOSDPGNotify> { public: - typedef boost::intrusive_ptr<MOSDPGNotify> ref; - typedef boost::intrusive_ptr<MOSDPGNotify const> const_ref; - using factory = MessageFactory<MOSDPGNotify>; friend factory; private: static const int HEAD_VERSION = 6; @@ -47,11 +44,11 @@ private: } MOSDPGNotify() - : Message(MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION) { + : MessageInstance(MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION) { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGNotify(epoch_t e, vector<pair<pg_notify_t,PastIntervals> >& l) - : Message(MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_NOTIFY, HEAD_VERSION, COMPAT_VERSION), epoch(e) { pg_list.swap(l); set_priority(CEPH_MSG_PRIO_HIGH); diff --git a/src/messages/MOSDPGPull.h b/src/messages/MOSDPGPull.h index 3e3d91321f2..79c13a19e64 100644 --- a/src/messages/MOSDPGPull.h +++ b/src/messages/MOSDPGPull.h @@ -17,11 +17,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGPull : public MOSDFastDispatchOp { +class MOSDPGPull : public MessageInstance<MOSDPGPull, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGPull> ref; - typedef boost::intrusive_ptr<MOSDPGPull const> const_ref; - using factory = MessageFactory<MOSDPGPull>; friend factory; private: static const int HEAD_VERSION = 3; @@ -53,7 +50,7 @@ public: } MOSDPGPull() - : MOSDFastDispatchOp(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION), cost(0) {} diff --git a/src/messages/MOSDPGPush.h b/src/messages/MOSDPGPush.h index 1a27bc39159..77864cceaba 100644 --- a/src/messages/MOSDPGPush.h +++ b/src/messages/MOSDPGPush.h @@ -17,11 +17,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGPush : public MOSDFastDispatchOp { +class MOSDPGPush : public MessageInstance<MOSDPGPush, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGPush> ref; - typedef boost::intrusive_ptr<MOSDPGPush const> const_ref; - using factory = MessageFactory<MOSDPGPush>; friend factory; private: static const int HEAD_VERSION = 3; @@ -65,7 +62,7 @@ public: } MOSDPGPush() - : MOSDFastDispatchOp(MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_PUSH, HEAD_VERSION, COMPAT_VERSION), cost(0) {} diff --git a/src/messages/MOSDPGPushReply.h b/src/messages/MOSDPGPushReply.h index 8b718c62282..dc0d6bfb98d 100644 --- a/src/messages/MOSDPGPushReply.h +++ b/src/messages/MOSDPGPushReply.h @@ -17,11 +17,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGPushReply : public MOSDFastDispatchOp { +class MOSDPGPushReply : public MessageInstance<MOSDPGPushReply, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGPushReply> ref; - typedef boost::intrusive_ptr<MOSDPGPushReply const> const_ref; - using factory = MessageFactory<MOSDPGPushReply>; friend factory; private: static const int HEAD_VERSION = 3; @@ -45,7 +42,7 @@ public: } MOSDPGPushReply() - : MOSDFastDispatchOp(MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_PUSH_REPLY, HEAD_VERSION, COMPAT_VERSION), cost(0) {} diff --git a/src/messages/MOSDPGQuery.h b/src/messages/MOSDPGQuery.h index 70768a1c72b..fe561ab068e 100644 --- a/src/messages/MOSDPGQuery.h +++ b/src/messages/MOSDPGQuery.h @@ -23,11 +23,8 @@ * PGQuery - query another OSD as to the contents of their PGs */ -class MOSDPGQuery : public Message { +class MOSDPGQuery : public MessageInstance<MOSDPGQuery> { public: - typedef boost::intrusive_ptr<MOSDPGQuery> ref; - typedef boost::intrusive_ptr<MOSDPGQuery const> const_ref; - using factory = MessageFactory<MOSDPGQuery>; friend factory; private: static const int HEAD_VERSION = 4; @@ -39,13 +36,13 @@ private: version_t get_epoch() const { return epoch; } map<spg_t, pg_query_t> pg_list; - MOSDPGQuery() : Message(MSG_OSD_PG_QUERY, + MOSDPGQuery() : MessageInstance(MSG_OSD_PG_QUERY, HEAD_VERSION, COMPAT_VERSION) { set_priority(CEPH_MSG_PRIO_HIGH); } MOSDPGQuery(epoch_t e, map<spg_t,pg_query_t>& ls) : - Message(MSG_OSD_PG_QUERY, + MessageInstance(MSG_OSD_PG_QUERY, HEAD_VERSION, COMPAT_VERSION), epoch(e) { diff --git a/src/messages/MOSDPGRecoveryDelete.h b/src/messages/MOSDPGRecoveryDelete.h index 3730cd33994..ac4152567fa 100644 --- a/src/messages/MOSDPGRecoveryDelete.h +++ b/src/messages/MOSDPGRecoveryDelete.h @@ -10,11 +10,8 @@ * instruct non-primary to remove some objects during recovery */ -class MOSDPGRecoveryDelete : public MOSDFastDispatchOp { +class MOSDPGRecoveryDelete : public MessageInstance<MOSDPGRecoveryDelete, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGRecoveryDelete> ref; - typedef boost::intrusive_ptr<MOSDPGRecoveryDelete const> const_ref; - using factory = MessageFactory<MOSDPGRecoveryDelete>; friend factory; static const int HEAD_VERSION = 2; @@ -48,12 +45,12 @@ public: } MOSDPGRecoveryDelete() - : MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION, + : MessageInstance(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION, COMPAT_VERSION), cost(0) {} MOSDPGRecoveryDelete(pg_shard_t from, spg_t pgid, epoch_t map_epoch, epoch_t min_epoch) - : MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION, + : MessageInstance(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION, COMPAT_VERSION), from(from), pgid(pgid), diff --git a/src/messages/MOSDPGRecoveryDeleteReply.h b/src/messages/MOSDPGRecoveryDeleteReply.h index ca414bb7282..f48e436349c 100644 --- a/src/messages/MOSDPGRecoveryDeleteReply.h +++ b/src/messages/MOSDPGRecoveryDeleteReply.h @@ -6,11 +6,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp { +class MOSDPGRecoveryDeleteReply : public MessageInstance<MOSDPGRecoveryDeleteReply, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGRecoveryDeleteReply> ref; - typedef boost::intrusive_ptr<MOSDPGRecoveryDeleteReply const> const_ref; - using factory = MessageFactory<MOSDPGRecoveryDeleteReply>; friend factory; static const int HEAD_VERSION = 2; @@ -32,7 +29,7 @@ public: } MOSDPGRecoveryDeleteReply() - : MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION), map_epoch(0), min_epoch(0) {} diff --git a/src/messages/MOSDPGRemove.h b/src/messages/MOSDPGRemove.h index 278f184b8b5..dd7b62bc441 100644 --- a/src/messages/MOSDPGRemove.h +++ b/src/messages/MOSDPGRemove.h @@ -20,11 +20,8 @@ #include "msg/Message.h" -class MOSDPGRemove : public Message { +class MOSDPGRemove : public MessageInstance<MOSDPGRemove> { public: - typedef boost::intrusive_ptr<MOSDPGRemove> ref; - typedef boost::intrusive_ptr<MOSDPGRemove const> const_ref; - using factory = MessageFactory<MOSDPGRemove>; friend factory; private: static const int HEAD_VERSION = 3; @@ -38,9 +35,9 @@ private: epoch_t get_epoch() const { return epoch; } MOSDPGRemove() : - Message(MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION) {} + MessageInstance(MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGRemove(epoch_t e, vector<spg_t>& l) : - Message(MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION) { + MessageInstance(MSG_OSD_PG_REMOVE, HEAD_VERSION, COMPAT_VERSION) { this->epoch = e; pg_list.swap(l); } diff --git a/src/messages/MOSDPGScan.h b/src/messages/MOSDPGScan.h index 50d0a140864..4da8aac5128 100644 --- a/src/messages/MOSDPGScan.h +++ b/src/messages/MOSDPGScan.h @@ -17,11 +17,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGScan : public MOSDFastDispatchOp { +class MOSDPGScan : public MessageInstance<MOSDPGScan, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGScan> ref; - typedef boost::intrusive_ptr<MOSDPGScan const> const_ref; - using factory = MessageFactory<MOSDPGScan>; friend factory; private: static const int HEAD_VERSION = 2; @@ -93,10 +90,10 @@ public: } MOSDPGScan() - : MOSDFastDispatchOp(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGScan(__u32 o, pg_shard_t from, epoch_t e, epoch_t qe, spg_t p, hobject_t be, hobject_t en) - : MOSDFastDispatchOp(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PG_SCAN, HEAD_VERSION, COMPAT_VERSION), op(o), map_epoch(e), query_epoch(qe), from(from), diff --git a/src/messages/MOSDPGTemp.h b/src/messages/MOSDPGTemp.h index c06f8d0231d..68f2219fead 100644 --- a/src/messages/MOSDPGTemp.h +++ b/src/messages/MOSDPGTemp.h @@ -19,11 +19,8 @@ #include "messages/PaxosServiceMessage.h" -class MOSDPGTemp : public PaxosServiceMessage { +class MOSDPGTemp : public MessageInstance<MOSDPGTemp, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MOSDPGTemp> ref; - typedef boost::intrusive_ptr<MOSDPGTemp const> const_ref; - using factory = MessageFactory<MOSDPGTemp>; friend factory; epoch_t map_epoch = 0; @@ -31,7 +28,7 @@ public: bool forced = false; MOSDPGTemp(epoch_t e) - : PaxosServiceMessage(MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION), map_epoch(e) {} MOSDPGTemp() diff --git a/src/messages/MOSDPGTrim.h b/src/messages/MOSDPGTrim.h index 106443798d6..ce8312dcaee 100644 --- a/src/messages/MOSDPGTrim.h +++ b/src/messages/MOSDPGTrim.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "messages/MOSDPeeringOp.h" -class MOSDPGTrim : public MOSDPeeringOp { +class MOSDPGTrim : public MessageInstance<MOSDPGTrim, MOSDPeeringOp> { public: - typedef boost::intrusive_ptr<MOSDPGTrim> ref; - typedef boost::intrusive_ptr<MOSDPGTrim const> const_ref; - using factory = MessageFactory<MOSDPGTrim>; friend factory; private: static const int HEAD_VERSION = 2; @@ -50,9 +47,9 @@ public: MTrim(epoch, get_source().num(), pgid.shard, trim_to)); } - MOSDPGTrim() : MOSDPeeringOp(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION) {} + MOSDPGTrim() : MessageInstance(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION) {} MOSDPGTrim(version_t mv, spg_t p, eversion_t tt) : - MOSDPeeringOp(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_PG_TRIM, HEAD_VERSION, COMPAT_VERSION), epoch(mv), pgid(p), trim_to(tt) { } private: ~MOSDPGTrim() override {} diff --git a/src/messages/MOSDPGUpdateLogMissing.h b/src/messages/MOSDPGUpdateLogMissing.h index 91923cff9dc..1764c23f1b5 100644 --- a/src/messages/MOSDPGUpdateLogMissing.h +++ b/src/messages/MOSDPGUpdateLogMissing.h @@ -18,11 +18,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGUpdateLogMissing : public MOSDFastDispatchOp { +class MOSDPGUpdateLogMissing : public MessageInstance<MOSDPGUpdateLogMissing, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGUpdateLogMissing> ref; - typedef boost::intrusive_ptr<MOSDPGUpdateLogMissing const> const_ref; - using factory = MessageFactory<MOSDPGUpdateLogMissing>; friend factory; private: static const int HEAD_VERSION = 3; @@ -55,7 +52,7 @@ public: } MOSDPGUpdateLogMissing() - : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, + : MessageInstance(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION) { } MOSDPGUpdateLogMissing( const mempool::osd_pglog::list<pg_log_entry_t> &entries, @@ -66,7 +63,7 @@ public: ceph_tid_t rep_tid, eversion_t pg_trim_to, eversion_t pg_roll_forward_to) - : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, + : MessageInstance(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION), map_epoch(epoch), min_epoch(min_epoch), diff --git a/src/messages/MOSDPGUpdateLogMissingReply.h b/src/messages/MOSDPGUpdateLogMissingReply.h index a6bdef7a65a..9a7df150ee8 100644 --- a/src/messages/MOSDPGUpdateLogMissingReply.h +++ b/src/messages/MOSDPGUpdateLogMissingReply.h @@ -18,11 +18,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDPGUpdateLogMissingReply : public MOSDFastDispatchOp { +class MOSDPGUpdateLogMissingReply : public MessageInstance<MOSDPGUpdateLogMissingReply, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDPGUpdateLogMissingReply> ref; - typedef boost::intrusive_ptr<MOSDPGUpdateLogMissingReply const> const_ref; - using factory = MessageFactory<MOSDPGUpdateLogMissingReply>; friend factory; private: static const int HEAD_VERSION = 3; @@ -55,7 +52,7 @@ public: } MOSDPGUpdateLogMissingReply() - : MOSDFastDispatchOp( + : MessageInstance( MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION, COMPAT_VERSION) @@ -67,7 +64,7 @@ public: epoch_t min_epoch, ceph_tid_t rep_tid, eversion_t last_complete_ondisk) - : MOSDFastDispatchOp( + : MessageInstance( MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY, HEAD_VERSION, COMPAT_VERSION), diff --git a/src/messages/MOSDPeeringOp.h b/src/messages/MOSDPeeringOp.h index f1c2a60db55..25487488a62 100644 --- a/src/messages/MOSDPeeringOp.h +++ b/src/messages/MOSDPeeringOp.h @@ -7,15 +7,11 @@ #include "osd/osd_types.h" #include "osd/PGPeeringEvent.h" -class MOSDPeeringOp : public Message { +class MOSDPeeringOp : public MessageSubType<MOSDPeeringOp> { public: - typedef boost::intrusive_ptr<MOSDPeeringOp> ref; - typedef boost::intrusive_ptr<MOSDPeeringOp const> const_ref; - using factory = MessageFactory<MOSDPeeringOp>; - friend factory; - MOSDPeeringOp(int t, int version, int compat_version) - : Message(t, version, compat_version) {} +template<typename... Args> + MOSDPeeringOp(Args&&... args) : MessageSubType(std::forward<Args>(args)...) {} void print(ostream& out) const override final { out << get_type_name() << "(" diff --git a/src/messages/MOSDPing.h b/src/messages/MOSDPing.h index 3fd98fe40ee..1728cf8e565 100644 --- a/src/messages/MOSDPing.h +++ b/src/messages/MOSDPing.h @@ -32,11 +32,8 @@ #include "osd/osd_types.h" -class MOSDPing : public Message { +class MOSDPing : public MessageInstance<MOSDPing> { public: - typedef boost::intrusive_ptr<MOSDPing> ref; - typedef boost::intrusive_ptr<MOSDPing const> const_ref; - using factory = MessageFactory<MOSDPing>; friend factory; private: static const int HEAD_VERSION = 4; @@ -70,11 +67,11 @@ private: uint32_t min_message_size; MOSDPing(const uuid_d& f, epoch_t e, __u8 o, utime_t s, uint32_t min_message) - : Message(MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION), fsid(f), map_epoch(e), op(o), stamp(s), min_message_size(min_message) { } MOSDPing() - : Message(MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION), min_message_size(0) + : MessageInstance(MSG_OSD_PING, HEAD_VERSION, COMPAT_VERSION), min_message_size(0) {} private: ~MOSDPing() override {} diff --git a/src/messages/MOSDRepOp.h b/src/messages/MOSDRepOp.h index 6c26aadf302..daacad60406 100644 --- a/src/messages/MOSDRepOp.h +++ b/src/messages/MOSDRepOp.h @@ -22,11 +22,8 @@ * OSD sub op - for internal ops on pobjects between primary and replicas(/stripes/whatever) */ -class MOSDRepOp : public MOSDFastDispatchOp { +class MOSDRepOp : public MessageInstance<MOSDRepOp, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDRepOp> ref; - typedef boost::intrusive_ptr<MOSDRepOp const> const_ref; - using factory = MessageFactory<MOSDRepOp>; friend factory; private: static const int HEAD_VERSION = 2; @@ -144,13 +141,13 @@ public: } MOSDRepOp() - : MOSDFastDispatchOp(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), map_epoch(0), final_decode_needed(true), acks_wanted (0) {} MOSDRepOp(osd_reqid_t r, pg_shard_t from, spg_t p, const hobject_t& po, int aw, epoch_t mape, epoch_t min_epoch, ceph_tid_t rtid, eversion_t v) - : MOSDFastDispatchOp(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), map_epoch(mape), min_epoch(min_epoch), reqid(r), diff --git a/src/messages/MOSDRepOpReply.h b/src/messages/MOSDRepOpReply.h index d8eea147195..23986484658 100644 --- a/src/messages/MOSDRepOpReply.h +++ b/src/messages/MOSDRepOpReply.h @@ -28,11 +28,8 @@ * */ -class MOSDRepOpReply : public MOSDFastDispatchOp { +class MOSDRepOpReply : public MessageInstance<MOSDRepOpReply, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDRepOpReply> ref; - typedef boost::intrusive_ptr<MOSDRepOpReply const> const_ref; - using factory = MessageFactory<MOSDRepOpReply>; friend factory; private: static const int HEAD_VERSION = 2; @@ -122,7 +119,7 @@ public: MOSDRepOpReply( const MOSDRepOp *req, pg_shard_t from, int result_, epoch_t e, epoch_t mine, int at) : - MOSDFastDispatchOp(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), map_epoch(e), min_epoch(mine), reqid(req->reqid), @@ -134,7 +131,7 @@ public: set_tid(req->get_tid()); } MOSDRepOpReply() - : MOSDFastDispatchOp(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_REPOPREPLY, HEAD_VERSION, COMPAT_VERSION), map_epoch(0), min_epoch(0), ack_type(0), result(0), diff --git a/src/messages/MOSDRepScrub.h b/src/messages/MOSDRepScrub.h index 1610fd10866..69714ccc4f2 100644 --- a/src/messages/MOSDRepScrub.h +++ b/src/messages/MOSDRepScrub.h @@ -22,11 +22,8 @@ * instruct an OSD initiate a replica scrub on a specific PG */ -class MOSDRepScrub : public MOSDFastDispatchOp { +class MOSDRepScrub : public MessageInstance<MOSDRepScrub, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDRepScrub> ref; - typedef boost::intrusive_ptr<MOSDRepScrub const> const_ref; - using factory = MessageFactory<MOSDRepScrub>; friend factory; static const int HEAD_VERSION = 9; @@ -55,14 +52,14 @@ public: } MOSDRepScrub() - : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), chunky(false), deep(false) { } MOSDRepScrub(spg_t pgid, eversion_t scrub_to, epoch_t map_epoch, epoch_t min_epoch, hobject_t start, hobject_t end, bool deep, bool preemption, int prio, bool highprio) - : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), scrub_to(scrub_to), map_epoch(map_epoch), diff --git a/src/messages/MOSDRepScrubMap.h b/src/messages/MOSDRepScrubMap.h index b32717808ed..96705d0f51d 100644 --- a/src/messages/MOSDRepScrubMap.h +++ b/src/messages/MOSDRepScrubMap.h @@ -21,11 +21,8 @@ * pass a ScrubMap from a shard back to the primary */ -class MOSDRepScrubMap : public MOSDFastDispatchOp { +class MOSDRepScrubMap : public MessageInstance<MOSDRepScrubMap, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDRepScrubMap> ref; - typedef boost::intrusive_ptr<MOSDRepScrubMap const> const_ref; - using factory = MessageFactory<MOSDRepScrubMap>; friend factory; static const int HEAD_VERSION = 2; @@ -45,10 +42,10 @@ public: } MOSDRepScrubMap() - : MOSDFastDispatchOp(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION) {} + : MessageInstance(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION) {} MOSDRepScrubMap(spg_t pgid, epoch_t map_epoch, pg_shard_t from) - : MOSDFastDispatchOp(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_REP_SCRUBMAP, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), map_epoch(map_epoch), from(from) {} diff --git a/src/messages/MOSDScrub.h b/src/messages/MOSDScrub.h index a487dd1700e..f46ff174756 100644 --- a/src/messages/MOSDScrub.h +++ b/src/messages/MOSDScrub.h @@ -22,11 +22,8 @@ * instruct an OSD to scrub some or all pg(s) */ -class MOSDScrub : public Message { +class MOSDScrub : public MessageInstance<MOSDScrub> { public: - typedef boost::intrusive_ptr<MOSDScrub> ref; - typedef boost::intrusive_ptr<MOSDScrub const> const_ref; - using factory = MessageFactory<MOSDScrub>; friend factory; static const int HEAD_VERSION = 2; @@ -37,12 +34,12 @@ public: bool repair = false; bool deep = false; - MOSDScrub() : Message(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION) {} + MOSDScrub() : MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION) {} MOSDScrub(const uuid_d& f, bool r, bool d) : - Message(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION), fsid(f), repair(r), deep(d) {} MOSDScrub(const uuid_d& f, vector<pg_t>& pgs, bool r, bool d) : - Message(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_SCRUB, HEAD_VERSION, COMPAT_VERSION), fsid(f), scrub_pgs(pgs), repair(r), deep(d) {} private: ~MOSDScrub() override {} diff --git a/src/messages/MOSDScrub2.h b/src/messages/MOSDScrub2.h index 96ec1ae622d..28e1d2a3bf3 100644 --- a/src/messages/MOSDScrub2.h +++ b/src/messages/MOSDScrub2.h @@ -9,11 +9,8 @@ * instruct an OSD to scrub some or all pg(s) */ -class MOSDScrub2 : public Message { +class MOSDScrub2 : public MessageInstance<MOSDScrub2> { public: - typedef boost::intrusive_ptr<MOSDScrub2> ref; - typedef boost::intrusive_ptr<MOSDScrub2 const> const_ref; - using factory = MessageFactory<MOSDScrub2>; friend factory; static const int HEAD_VERSION = 1; @@ -25,9 +22,9 @@ public: bool repair = false; bool deep = false; - MOSDScrub2() : Message(MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION) {} + MOSDScrub2() : MessageInstance(MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION) {} MOSDScrub2(const uuid_d& f, epoch_t e, vector<spg_t>& pgs, bool r, bool d) : - Message(MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_OSD_SCRUB2, HEAD_VERSION, COMPAT_VERSION), fsid(f), epoch(e), scrub_pgs(pgs), repair(r), deep(d) {} private: ~MOSDScrub2() override {} diff --git a/src/messages/MOSDScrubReserve.h b/src/messages/MOSDScrubReserve.h index 94d71643075..5cab78d59d2 100644 --- a/src/messages/MOSDScrubReserve.h +++ b/src/messages/MOSDScrubReserve.h @@ -17,11 +17,8 @@ #include "MOSDFastDispatchOp.h" -class MOSDScrubReserve : public MOSDFastDispatchOp { +class MOSDScrubReserve : public MessageInstance<MOSDScrubReserve, MOSDFastDispatchOp> { public: - typedef boost::intrusive_ptr<MOSDScrubReserve> ref; - typedef boost::intrusive_ptr<MOSDScrubReserve const> const_ref; - using factory = MessageFactory<MOSDScrubReserve>; friend factory; private: static const int HEAD_VERSION = 1; @@ -46,13 +43,13 @@ public: } MOSDScrubReserve() - : MOSDFastDispatchOp(MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION), map_epoch(0), type(-1) {} MOSDScrubReserve(spg_t pgid, epoch_t map_epoch, int type, pg_shard_t from) - : MOSDFastDispatchOp(MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_SCRUB_RESERVE, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), map_epoch(map_epoch), type(type), from(from) {} diff --git a/src/messages/MPGStats.h b/src/messages/MPGStats.h index 7c49156db38..3988318a5a8 100644 --- a/src/messages/MPGStats.h +++ b/src/messages/MPGStats.h @@ -18,11 +18,8 @@ #include "osd/osd_types.h" #include "messages/PaxosServiceMessage.h" -class MPGStats : public PaxosServiceMessage { +class MPGStats : public MessageInstance<MPGStats, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MPGStats> ref; - typedef boost::intrusive_ptr<MPGStats const> const_ref; - using factory = MessageFactory<MPGStats>; friend factory; uuid_d fsid; @@ -31,9 +28,9 @@ public: epoch_t epoch = 0; utime_t had_map_for; - MPGStats() : PaxosServiceMessage(MSG_PGSTATS, 0) {} + MPGStats() : MessageInstance(MSG_PGSTATS, 0) {} MPGStats(const uuid_d& f, epoch_t e, utime_t had) - : PaxosServiceMessage(MSG_PGSTATS, 0), + : MessageInstance(MSG_PGSTATS, 0), fsid(f), epoch(e), had_map_for(had) diff --git a/src/messages/MPGStatsAck.h b/src/messages/MPGStatsAck.h index 2080e31109f..20268553001 100644 --- a/src/messages/MPGStatsAck.h +++ b/src/messages/MPGStatsAck.h @@ -17,16 +17,13 @@ #include "osd/osd_types.h" -class MPGStatsAck : public Message { +class MPGStatsAck : public MessageInstance<MPGStatsAck> { public: - typedef boost::intrusive_ptr<MPGStatsAck> ref; - typedef boost::intrusive_ptr<MPGStatsAck const> const_ref; - using factory = MessageFactory<MPGStatsAck>; friend factory; map<pg_t,pair<version_t,epoch_t> > pg_stat; - MPGStatsAck() : Message(MSG_PGSTATSACK) {} + MPGStatsAck() : MessageInstance(MSG_PGSTATSACK) {} private: ~MPGStatsAck() override {} diff --git a/src/messages/MPing.h b/src/messages/MPing.h index 88fedb29a18..6de6dac6ff6 100644 --- a/src/messages/MPing.h +++ b/src/messages/MPing.h @@ -18,14 +18,11 @@ #include "msg/Message.h" -class MPing : public Message { +class MPing : public MessageInstance<MPing> { public: - typedef boost::intrusive_ptr<MPing> ref; - typedef boost::intrusive_ptr<MPing const> const_ref; - using factory = MessageFactory<MPing>; friend factory; - MPing() : Message(CEPH_MSG_PING) {} + MPing() : MessageInstance(CEPH_MSG_PING) {} private: ~MPing() override {} diff --git a/src/messages/MPoolOp.h b/src/messages/MPoolOp.h index 8ad344ef559..8a6ba7d8e39 100644 --- a/src/messages/MPoolOp.h +++ b/src/messages/MPoolOp.h @@ -18,11 +18,8 @@ #include "messages/PaxosServiceMessage.h" -class MPoolOp : public PaxosServiceMessage { +class MPoolOp : public MessageInstance<MPoolOp, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MPoolOp> ref; - typedef boost::intrusive_ptr<MPoolOp const> const_ref; - using factory = MessageFactory<MPoolOp>; friend factory; private: static const int HEAD_VERSION = 4; @@ -38,16 +35,16 @@ public: __s16 crush_rule = 0; MPoolOp() - : PaxosServiceMessage(CEPH_MSG_POOLOP, 0, HEAD_VERSION, COMPAT_VERSION) { } + : MessageInstance(CEPH_MSG_POOLOP, 0, HEAD_VERSION, COMPAT_VERSION) { } MPoolOp(const uuid_d& f, ceph_tid_t t, int p, string& n, int o, version_t v) - : PaxosServiceMessage(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION), fsid(f), pool(p), name(n), op(o), auid(0), snapid(0), crush_rule(0) { set_tid(t); } MPoolOp(const uuid_d& f, ceph_tid_t t, int p, string& n, int o, uint64_t uid, version_t v) - : PaxosServiceMessage(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_POOLOP, v, HEAD_VERSION, COMPAT_VERSION), fsid(f), pool(p), name(n), op(o), auid(uid), snapid(0), crush_rule(0) { set_tid(t); diff --git a/src/messages/MPoolOpReply.h b/src/messages/MPoolOpReply.h index 13b13684cab..2e83a464a6a 100644 --- a/src/messages/MPoolOpReply.h +++ b/src/messages/MPoolOpReply.h @@ -17,11 +17,8 @@ #include "common/errno.h" -class MPoolOpReply : public PaxosServiceMessage { +class MPoolOpReply : public MessageInstance<MPoolOpReply, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MPoolOpReply> ref; - typedef boost::intrusive_ptr<MPoolOpReply const> const_ref; - using factory = MessageFactory<MPoolOpReply>; friend factory; uuid_d fsid; @@ -29,10 +26,10 @@ public: epoch_t epoch = 0; bufferlist response_data; - MPoolOpReply() : PaxosServiceMessage(CEPH_MSG_POOLOP_REPLY, 0) + MPoolOpReply() : MessageInstance(CEPH_MSG_POOLOP_REPLY, 0) {} MPoolOpReply( uuid_d& f, ceph_tid_t t, int rc, int e, version_t v) : - PaxosServiceMessage(CEPH_MSG_POOLOP_REPLY, v), + MessageInstance(CEPH_MSG_POOLOP_REPLY, v), fsid(f), replyCode(rc), epoch(e) { @@ -40,7 +37,7 @@ public: } MPoolOpReply( uuid_d& f, ceph_tid_t t, int rc, int e, version_t v, bufferlist *blp) : - PaxosServiceMessage(CEPH_MSG_POOLOP_REPLY, v), + MessageInstance(CEPH_MSG_POOLOP_REPLY, v), fsid(f), replyCode(rc), epoch(e) { diff --git a/src/messages/MRecoveryReserve.h b/src/messages/MRecoveryReserve.h index a0eb2a5e33d..344eae5516b 100644 --- a/src/messages/MRecoveryReserve.h +++ b/src/messages/MRecoveryReserve.h @@ -18,11 +18,8 @@ #include "msg/Message.h" #include "messages/MOSDPeeringOp.h" -class MRecoveryReserve : public MOSDPeeringOp { +class MRecoveryReserve : public MessageInstance<MRecoveryReserve, MOSDPeeringOp> { public: - typedef boost::intrusive_ptr<MRecoveryReserve> ref; - typedef boost::intrusive_ptr<MRecoveryReserve const> const_ref; - using factory = MessageFactory<MRecoveryReserve>; friend factory; private: static const int HEAD_VERSION = 3; @@ -77,13 +74,13 @@ public: } MRecoveryReserve() - : MOSDPeeringOp(MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION), query_epoch(0), type(-1) {} MRecoveryReserve(int type, spg_t pgid, epoch_t query_epoch, unsigned prio = 0) - : MOSDPeeringOp(MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_OSD_RECOVERY_RESERVE, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), query_epoch(query_epoch), type(type), priority(prio) {} diff --git a/src/messages/MRemoveSnaps.h b/src/messages/MRemoveSnaps.h index c0f83bfc526..9d983d5edb6 100644 --- a/src/messages/MRemoveSnaps.h +++ b/src/messages/MRemoveSnaps.h @@ -17,20 +17,17 @@ #include "messages/PaxosServiceMessage.h" -class MRemoveSnaps : public PaxosServiceMessage { +class MRemoveSnaps : public MessageInstance<MRemoveSnaps, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MRemoveSnaps> ref; - typedef boost::intrusive_ptr<MRemoveSnaps const> const_ref; - using factory = MessageFactory<MRemoveSnaps>; friend factory; map<int, vector<snapid_t> > snaps; protected: MRemoveSnaps() : - PaxosServiceMessage(MSG_REMOVE_SNAPS, 0) { } + MessageInstance(MSG_REMOVE_SNAPS, 0) { } MRemoveSnaps(map<int, vector<snapid_t> >& s) : - PaxosServiceMessage(MSG_REMOVE_SNAPS, 0) { + MessageInstance(MSG_REMOVE_SNAPS, 0) { snaps.swap(s); } ~MRemoveSnaps() override {} diff --git a/src/messages/MRoute.h b/src/messages/MRoute.h index 74228cfbb66..b858abe414b 100644 --- a/src/messages/MRoute.h +++ b/src/messages/MRoute.h @@ -20,11 +20,8 @@ #include "msg/Message.h" #include "include/encoding.h" -class MRoute : public Message { +class MRoute : public MessageInstance<MRoute> { public: - typedef boost::intrusive_ptr<MRoute> ref; - typedef boost::intrusive_ptr<MRoute const> const_ref; - using factory = MessageFactory<MRoute>; friend factory; static const int HEAD_VERSION = 3; @@ -34,12 +31,12 @@ public: Message *msg; epoch_t send_osdmap_first; - MRoute() : Message(MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION), + MRoute() : MessageInstance(MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION), session_mon_tid(0), msg(NULL), send_osdmap_first(0) {} MRoute(uint64_t t, Message *m) - : Message(MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(MSG_ROUTE, HEAD_VERSION, COMPAT_VERSION), session_mon_tid(t), msg(m), send_osdmap_first(0) {} diff --git a/src/messages/MServiceMap.h b/src/messages/MServiceMap.h index 084044c3862..565f3f406e2 100644 --- a/src/messages/MServiceMap.h +++ b/src/messages/MServiceMap.h @@ -6,18 +6,15 @@ #include "msg/Message.h" #include "mgr/ServiceMap.h" -class MServiceMap : public Message { +class MServiceMap : public MessageInstance<MServiceMap> { public: - typedef boost::intrusive_ptr<MServiceMap> ref; - typedef boost::intrusive_ptr<MServiceMap const> const_ref; - using factory = MessageFactory<MServiceMap>; friend factory; ServiceMap service_map; - MServiceMap() : Message(MSG_SERVICE_MAP) { } + MServiceMap() : MessageInstance(MSG_SERVICE_MAP) { } explicit MServiceMap(const ServiceMap& sm) - : Message(MSG_SERVICE_MAP), + : MessageInstance(MSG_SERVICE_MAP), service_map(sm) { } private: diff --git a/src/messages/MStatfs.h b/src/messages/MStatfs.h index 392c931242b..71f2d7fea55 100644 --- a/src/messages/MStatfs.h +++ b/src/messages/MStatfs.h @@ -19,11 +19,8 @@ #include <sys/statvfs.h> /* or <sys/statfs.h> */ #include "messages/PaxosServiceMessage.h" -class MStatfs : public PaxosServiceMessage { +class MStatfs : public MessageInstance<MStatfs, PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<MStatfs> ref; - typedef boost::intrusive_ptr<MStatfs const> const_ref; - using factory = MessageFactory<MStatfs>; friend factory; private: static const int HEAD_VERSION = 2; @@ -33,9 +30,9 @@ public: uuid_d fsid; boost::optional<int64_t> data_pool; - MStatfs() : PaxosServiceMessage(CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION) {} + MStatfs() : MessageInstance(CEPH_MSG_STATFS, 0, HEAD_VERSION, COMPAT_VERSION) {} MStatfs(const uuid_d& f, ceph_tid_t t, boost::optional<int64_t> _data_pool, - version_t v) : PaxosServiceMessage(CEPH_MSG_STATFS, v, + version_t v) : MessageInstance(CEPH_MSG_STATFS, v, HEAD_VERSION, COMPAT_VERSION), fsid(f), data_pool(_data_pool) { set_tid(t); diff --git a/src/messages/MStatfsReply.h b/src/messages/MStatfsReply.h index b925b31afdf..59738c8d293 100644 --- a/src/messages/MStatfsReply.h +++ b/src/messages/MStatfsReply.h @@ -16,17 +16,14 @@ #ifndef CEPH_MSTATFSREPLY_H #define CEPH_MSTATFSREPLY_H -class MStatfsReply : public Message { +class MStatfsReply : public MessageInstance<MStatfsReply> { public: - typedef boost::intrusive_ptr<MStatfsReply> ref; - typedef boost::intrusive_ptr<MStatfsReply const> const_ref; - using factory = MessageFactory<MStatfsReply>; friend factory; struct ceph_mon_statfs_reply h{}; - MStatfsReply() : Message(CEPH_MSG_STATFS_REPLY) {} - MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch) : Message(CEPH_MSG_STATFS_REPLY) { + MStatfsReply() : MessageInstance(CEPH_MSG_STATFS_REPLY) {} + MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch) : MessageInstance(CEPH_MSG_STATFS_REPLY) { memcpy(&h.fsid, f.bytes(), sizeof(h.fsid)); header.tid = t; h.version = epoch; diff --git a/src/messages/MTimeCheck.h b/src/messages/MTimeCheck.h index b8a7b75e145..5905c6b6a75 100644 --- a/src/messages/MTimeCheck.h +++ b/src/messages/MTimeCheck.h @@ -15,11 +15,8 @@ #ifndef CEPH_MTIMECHECK_H #define CEPH_MTIMECHECK_H -class MTimeCheck : public Message { +class MTimeCheck : public MessageInstance<MTimeCheck> { public: - typedef boost::intrusive_ptr<MTimeCheck> ref; - typedef boost::intrusive_ptr<MTimeCheck const> const_ref; - using factory = MessageFactory<MTimeCheck>; friend factory; static const int HEAD_VERSION = 1; @@ -38,9 +35,9 @@ public: map<entity_inst_t, double> skews; map<entity_inst_t, double> latencies; - MTimeCheck() : Message(MSG_TIMECHECK, HEAD_VERSION) { } + MTimeCheck() : MessageInstance(MSG_TIMECHECK, HEAD_VERSION) { } MTimeCheck(int op) : - Message(MSG_TIMECHECK, HEAD_VERSION), + MessageInstance(MSG_TIMECHECK, HEAD_VERSION), op(op) { } diff --git a/src/messages/MTimeCheck2.h b/src/messages/MTimeCheck2.h index bda6aef9cb9..56243d10a92 100644 --- a/src/messages/MTimeCheck2.h +++ b/src/messages/MTimeCheck2.h @@ -14,11 +14,8 @@ #pragma once -class MTimeCheck2 : public Message { +class MTimeCheck2 : public MessageInstance<MTimeCheck2> { public: - typedef boost::intrusive_ptr<MTimeCheck2> ref; - typedef boost::intrusive_ptr<MTimeCheck2 const> const_ref; - using factory = MessageFactory<MTimeCheck2>; friend factory; static const int HEAD_VERSION = 1; @@ -38,9 +35,9 @@ public: map<int, double> skews; map<int, double> latencies; - MTimeCheck2() : Message(MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION) { } + MTimeCheck2() : MessageInstance(MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION) { } MTimeCheck2(int op) : - Message(MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION), + MessageInstance(MSG_TIMECHECK2, HEAD_VERSION, COMPAT_VERSION), op(op) { } diff --git a/src/messages/MWatchNotify.h b/src/messages/MWatchNotify.h index e0ace85c50e..1300ba6d92e 100644 --- a/src/messages/MWatchNotify.h +++ b/src/messages/MWatchNotify.h @@ -19,11 +19,8 @@ #include "msg/Message.h" -class MWatchNotify : public Message { +class MWatchNotify : public MessageInstance<MWatchNotify> { public: - typedef boost::intrusive_ptr<MWatchNotify> ref; - typedef boost::intrusive_ptr<MWatchNotify const> const_ref; - using factory = MessageFactory<MWatchNotify>; friend factory; private: static const int HEAD_VERSION = 3; @@ -39,9 +36,9 @@ private: uint64_t notifier_gid; ///< who sent the notify MWatchNotify() - : Message(CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION) { } + : MessageInstance(CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION) { } MWatchNotify(uint64_t c, uint64_t v, uint64_t i, uint8_t o, bufferlist b) - : Message(CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION), + : MessageInstance(CEPH_MSG_WATCH_NOTIFY, HEAD_VERSION, COMPAT_VERSION), cookie(c), ver(v), notify_id(i), diff --git a/src/messages/PaxosServiceMessage.h b/src/messages/PaxosServiceMessage.h index d902e445e52..3532e3eb4f6 100644 --- a/src/messages/PaxosServiceMessage.h +++ b/src/messages/PaxosServiceMessage.h @@ -4,13 +4,8 @@ #include "msg/Message.h" #include "mon/Session.h" -class PaxosServiceMessage : public Message { +class PaxosServiceMessage : public MessageSubType<PaxosServiceMessage> { public: - typedef boost::intrusive_ptr<PaxosServiceMessage> ref; - typedef boost::intrusive_ptr<PaxosServiceMessage const> const_ref; - using factory = MessageFactory<PaxosServiceMessage>; - friend factory; - version_t version; __s16 deprecated_session_mon; uint64_t deprecated_session_mon_tid; @@ -20,15 +15,15 @@ public: epoch_t rx_election_epoch; PaxosServiceMessage() - : Message(MSG_PAXOS), + : MessageSubType(MSG_PAXOS), version(0), deprecated_session_mon(-1), deprecated_session_mon_tid(0), rx_election_epoch(0) { } PaxosServiceMessage(int type, version_t v, int enc_version=1, int compat_enc_version=0) - : Message(type, enc_version, compat_enc_version), + : MessageSubType(type, enc_version, compat_enc_version), version(v), deprecated_session_mon(-1), deprecated_session_mon_tid(0), rx_election_epoch(0) { } protected: - ~PaxosServiceMessage() override {} + virtual ~PaxosServiceMessage() override {} public: void paxos_encode() { diff --git a/src/msg/Message.h b/src/msg/Message.h index 6ffc1f2045a..b0005ff470b 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -528,4 +528,28 @@ template<typename... Args> } }; +template<class T, class M = Message> +class MessageSubType : public M { +public: + typedef boost::intrusive_ptr<T> ref; + typedef boost::intrusive_ptr<T const> const_ref; + +protected: +template<typename... Args> + MessageSubType(Args&&... args) : M(std::forward<Args>(args)...) {} + virtual ~MessageSubType() override {} +}; + + +template<class T, class M = Message> +class MessageInstance : public MessageSubType<T, M> { +public: + using factory = MessageFactory<T>; + +protected: +template<typename... Args> + MessageInstance(Args&&... args) : MessageSubType<T,M>(std::forward<Args>(args)...) {} + virtual ~MessageInstance() override {} +}; + #endif |