]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: cleanup factory/ref definition in messages
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 31 Jul 2018 20:59:52 +0000 (13:59 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 15 Aug 2018 20:36:38 +0000 (13:36 -0700)
This eliminates duplicate code definitions.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
152 files changed:
src/messages/MAuth.h
src/messages/MAuthReply.h
src/messages/MBackfillReserve.h
src/messages/MCacheExpire.h
src/messages/MClientCapRelease.h
src/messages/MClientCaps.h
src/messages/MClientLease.h
src/messages/MClientQuota.h
src/messages/MClientReconnect.h
src/messages/MClientReply.h
src/messages/MClientRequest.h
src/messages/MClientRequestForward.h
src/messages/MClientSession.h
src/messages/MClientSnap.h
src/messages/MCommand.h
src/messages/MCommandReply.h
src/messages/MConfig.h
src/messages/MDataPing.h
src/messages/MDentryLink.h
src/messages/MDentryUnlink.h
src/messages/MDirUpdate.h
src/messages/MDiscover.h
src/messages/MDiscoverReply.h
src/messages/MExportCaps.h
src/messages/MExportCapsAck.h
src/messages/MExportDir.h
src/messages/MExportDirAck.h
src/messages/MExportDirCancel.h
src/messages/MExportDirDiscover.h
src/messages/MExportDirDiscoverAck.h
src/messages/MExportDirFinish.h
src/messages/MExportDirNotify.h
src/messages/MExportDirNotifyAck.h
src/messages/MExportDirPrep.h
src/messages/MExportDirPrepAck.h
src/messages/MFSMap.h
src/messages/MFSMapUser.h
src/messages/MForward.h
src/messages/MGatherCaps.h
src/messages/MGenericMessage.h
src/messages/MGetConfig.h
src/messages/MGetPoolStats.h
src/messages/MGetPoolStatsReply.h
src/messages/MHeartbeat.h
src/messages/MInodeFileCaps.h
src/messages/MLock.h
src/messages/MLog.h
src/messages/MLogAck.h
src/messages/MMDSBeacon.h
src/messages/MMDSCacheRejoin.h
src/messages/MMDSFindIno.h
src/messages/MMDSFindInoReply.h
src/messages/MMDSFragmentNotify.h
src/messages/MMDSLoadTargets.h
src/messages/MMDSMap.h
src/messages/MMDSOpenIno.h
src/messages/MMDSOpenInoReply.h
src/messages/MMDSResolve.h
src/messages/MMDSResolveAck.h
src/messages/MMDSSlaveRequest.h
src/messages/MMDSSnapUpdate.h
src/messages/MMDSTableRequest.h
src/messages/MMgrBeacon.h
src/messages/MMgrClose.h
src/messages/MMgrConfigure.h
src/messages/MMgrDigest.h
src/messages/MMgrMap.h
src/messages/MMgrOpen.h
src/messages/MMgrReport.h
src/messages/MMonCommand.h
src/messages/MMonCommandAck.h
src/messages/MMonElection.h
src/messages/MMonGetMap.h
src/messages/MMonGetOSDMap.h
src/messages/MMonGetVersion.h
src/messages/MMonGetVersionReply.h
src/messages/MMonGlobalID.h
src/messages/MMonHealth.h
src/messages/MMonHealthChecks.h
src/messages/MMonJoin.h
src/messages/MMonMap.h
src/messages/MMonMetadata.h
src/messages/MMonMgrReport.h
src/messages/MMonPaxos.h
src/messages/MMonProbe.h
src/messages/MMonQuorumService.h
src/messages/MMonScrub.h
src/messages/MMonSubscribe.h
src/messages/MMonSubscribeAck.h
src/messages/MMonSync.h
src/messages/MNop.h
src/messages/MOSDAlive.h
src/messages/MOSDBackoff.h
src/messages/MOSDBeacon.h
src/messages/MOSDBoot.h
src/messages/MOSDECSubOpRead.h
src/messages/MOSDECSubOpReadReply.h
src/messages/MOSDECSubOpWrite.h
src/messages/MOSDECSubOpWriteReply.h
src/messages/MOSDFailure.h
src/messages/MOSDFastDispatchOp.h
src/messages/MOSDForceRecovery.h
src/messages/MOSDFull.h
src/messages/MOSDMap.h
src/messages/MOSDMarkMeDown.h
src/messages/MOSDOp.h
src/messages/MOSDOpReply.h
src/messages/MOSDPGBackfill.h
src/messages/MOSDPGBackfillRemove.h
src/messages/MOSDPGCreate.h
src/messages/MOSDPGCreate2.h
src/messages/MOSDPGCreated.h
src/messages/MOSDPGInfo.h
src/messages/MOSDPGLog.h
src/messages/MOSDPGNotify.h
src/messages/MOSDPGPull.h
src/messages/MOSDPGPush.h
src/messages/MOSDPGPushReply.h
src/messages/MOSDPGQuery.h
src/messages/MOSDPGRecoveryDelete.h
src/messages/MOSDPGRecoveryDeleteReply.h
src/messages/MOSDPGRemove.h
src/messages/MOSDPGScan.h
src/messages/MOSDPGTemp.h
src/messages/MOSDPGTrim.h
src/messages/MOSDPGUpdateLogMissing.h
src/messages/MOSDPGUpdateLogMissingReply.h
src/messages/MOSDPeeringOp.h
src/messages/MOSDPing.h
src/messages/MOSDRepOp.h
src/messages/MOSDRepOpReply.h
src/messages/MOSDRepScrub.h
src/messages/MOSDRepScrubMap.h
src/messages/MOSDScrub.h
src/messages/MOSDScrub2.h
src/messages/MOSDScrubReserve.h
src/messages/MPGStats.h
src/messages/MPGStatsAck.h
src/messages/MPing.h
src/messages/MPoolOp.h
src/messages/MPoolOpReply.h
src/messages/MRecoveryReserve.h
src/messages/MRemoveSnaps.h
src/messages/MRoute.h
src/messages/MServiceMap.h
src/messages/MStatfs.h
src/messages/MStatfsReply.h
src/messages/MTimeCheck.h
src/messages/MTimeCheck2.h
src/messages/MWatchNotify.h
src/messages/PaxosServiceMessage.h
src/msg/Message.h

index 96397fd7a3fb4677cdaca51401e139da599513ad..759a66ddcce74733fc3537bf1e4b64bdd08349c6 100644 (file)
 
 #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 {}
 
index 5fe8869adaf0793a262701ac701fe6be99521e38..4a4b509cc8db8525a7e300157c0c04c3c9661889 100644 (file)
 #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)
index 3d11aac9e289da1a6366e56501681a639628b077..b8d64f825e30451bb59513cf287ecf6478b82cf6 100644 (file)
 #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) {}
 
index 1fd699b8ef4aab4b4d1edcc88baaff12e79066fe..07153fcf024c2593c2a523bdfd017fc1207091e8 100644 (file)
 
 #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 {}
 
index 1cd8b87819c0c2a0c9e990b392539186faf3d915..8106d621c640bae3b1d83a4df191cdc730741a4f 100644 (file)
 #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));
index 323634261d9bba188ccfecebb9cbd1865daadc82..38abc02437bac35a67be13d17a09c922f8d7e291 100644 (file)
 #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;
index 25237c649ae21726cb1d52fdbcef81edb11dd60a..663f9c8a6ee51b24f0e535ccf3163540a2a16218 100644 (file)
 
 #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;
index cd58a9ed6f0fde4315ee0a317f496ee94eddbb85..bced9f1a033555e8bdc3fb0d52a1ebadb3415967 100644 (file)
@@ -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 {}
index 42e611131b8971dca455a1f0cb1e2fe2fb771359..96e9b210e845dc044fbc91781e0755fe778088cc 100644 (file)
 #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 {}
 
index 1a4765521b17599998fafca4f9b8120f3fa0758f..cdcc8a615bf212bf54082f2df767f6d58b81abf6 100644 (file)
@@ -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();
index 12a28dafc1bda60ba8a3076dff6e7a8d950b521a..f190979a9c50ecad7bf3f0f514b0cd2c4387ce4b 100644 (file)
 
 // 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;
   }
index b303a0c765bef6d138dd87add8858d6621ea306b..313818491711a43630365ae2b8639c7a956a2614 100644 (file)
 
 #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;
index 3f2d1b9d193dfcc6f9d89029b54fd501895e7d31..a672812fc29d5dce2ac53d8625b4502238e70e1c 100644 (file)
 #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;
index 21649cf9ea8d68ac508055fdef2c3531cdf84477..9c7927576e6f824bd8b24e748ab8efe856264742 100644 (file)
 
 #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;
   }
index 3f7d73999cf2cea7f85cc57653e0d1c72b9ee567..8a86258489ceb13b8b00f034b082290a1e99509e 100644 (file)
 
 #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:
index 3390aa8d787745322897b13da5303930d21ed050..622adfd808eb0ff7de209f5789faa0b7c7a9e710 100644 (file)
 #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 {}
index 1a0aa8d1f28cb8dacd539375979cd5127c31d758..ca79b9aa39ef77042253b8c345dcf517726c8049 100644 (file)
@@ -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 {
index 3d17669759dfbab603d3845af5918aa537db4b65..664e7ebcbbe20b268dedb04b04cc0fa0ae289ee4 100644 (file)
@@ -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)
   {}
index 8b483c881855d085bddd001589005e05e3614f3c..3ec69afe128c4efbf5940597e06ce1949d0a72d5 100644 (file)
 
 #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),
index e30827bb9f80ffe98372f74dd7a8064998ebd37e..6ac339a84b2083a2267d559edb40b24a846b9b65 100644 (file)
 
 #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 {}
index c96ccaa1f2747b27917187d91a51bdeba28b0aaa..b3e698d7aa1cc03f290144352c9784db84f91bf9 100644 (file)
 
 #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),
index a55f50075d7576353a714974054d5ae5f83c86c3..5f9196d066c6e1e676ac89f03280042326466f5c 100644 (file)
 #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),
index c8ed8cbcf4b310a551b3a46a3eb9a8730537bc92..a25fa135a6d16d456f0d1ac6bf8ebacb714c58ca 100644 (file)
  * 
  */
 
-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),
index 437ec785df0d6d49632a900ff35e68d1c10e8fdb..0b91f48ac4b6ba26d5530afd23a9250a93441f06 100644 (file)
 #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:
index 4479df5a9ddab3d0a0fed596ff8aa82ed7fb0f01..3aeefffc3d8fcd6df3e9616935cc8e56b79e5ff6 100644 (file)
 #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:
index 8c5e3284b3097ad8d9f468c2f492854f828e474b..4a451beeef427ca8b84e71527e283c758beda76a 100644 (file)
 #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 {}
index e88df8494efef50d9afd33e2e6706f95096bee29..ee8b68f98d0e368b5fdac147ab7ddd7729ccd02e 100644 (file)
 #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 {}
index 635abfec825f65302e9ad61481e560b290209f0c..54f9bec714229d99e844b8c5f38829c6508cd77f 100644 (file)
 #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 {}
index bcd3f1f34504207c74340b91eaaa77fb8e161acc..7264e7c248798747b37761a58b63c63b1f8aa11f 100644 (file)
 #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);
   }
index a663506156fe18503a172ad2134d7a57e6e8be71..ba769c3c2251269d1961318e032778ff86ee4d3c 100644 (file)
 #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);
   }
index 8c19ba55b640608547bea1028716315c6d630892..e538518c244b730d7d7d7d84a164952518bb4647 100644 (file)
 
 #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 {}
index 3004f3665f910c3ca87c8d62dbe046b4d2b6718d..8c8c756ac5160ae5b6bab9274cf1241b25b06dde 100644 (file)
 
 #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);
   }
index 844d9ec77a096e25a404a8a5d0c5646b36edc1cb..6d1ed62c9d54e6b8c481462ce02657762212aecf 100644 (file)
 
 #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 {}
index 01d5b244f7d1306e2283f634e9c86946086785ec..950fbf60241774fc7abff2735529efe8284e4637 100644 (file)
 #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);
   }
index 130ce65ea38ce50498805b7461db9b6531f45bcb..498dbdd14744412b5e948b1d53c571a6dc8241fe 100644 (file)
 #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 {}
index 67ab3506a01e70cba1b4ababc806a655e8a6fd82..4ce2783ba14b809e797035853528b0e3dc90edda 100644 (file)
 #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_;
   }
index a5c06f460caea9f494cc5372a9f82a96d206b20c..eb245f9d66f00d988badf4914323c5e8ec2d4541 100644 (file)
 #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_;
   }
index 9f681a34935705587b9f873a23c1eb58c359226c..9b34c086f95ac7c66ea13b3c971aae0c49acb434 100644 (file)
 #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();
index 8555f89551d80fd5825c3f7c3e75d12099d0e752..f05ddf6a7f3afde8d5f2c31bcbd967b328ced214 100644 (file)
@@ -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:
index 7ef0f6beff8b181ea3e13e319191c4bbef9e4d02..7b2f85df5e2e664b19821fc804659f7c0dcc69b5 100644 (file)
 
 #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());
   }
 
index d7add127e18fcc2009699eb4eabd533e04d7d044..11fc6c6fabbc6d65f5bc49559533d7b2edba8f36 100644 (file)
@@ -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) {}
 
index a21c6eb5c4b081f78b634e8fc92b03e4e52f0995..98103f37872b7b39c0acdbf0a560ef8d9ea01042 100644 (file)
 
 #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);
   }
index af4834b678aadb1dc0d605951966a404ffb1ac30..378b80448d510ca8a948abf7cb0c30a00f2d65db 100644 (file)
 #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);
   }
index 4d3c2001cf82c71bcb9f9da7157a70503f2788ed..bb142834392b357910b0c147171a022eeec7530d 100644 (file)
 #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;
   }
index a09189ec15db401028220bf948259c83cf4a5dd5..c01c487b4dd2b93a5c47da383d8d53669846f87b 100644 (file)
 
 #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;
   }
index 6e1cdccf3fc53f191f696de9f702c0fbfe36caa4..12811e2f72d78f8043b752ccc583c4a21a3afc6e 100644 (file)
 #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);
index 01e56418352eecc4280b6dd55e4aaf709a67ed6d..84ce8d7a7dd186298f04795474e4796b247d5223 100644 (file)
 
 #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 {}
 
index 91f74e9ac297457cc4489172db894cc7efe0694b..a696c6fdf42e8c1d37d28dd3b1fd6c3699332210 100644 (file)
 #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 {}
 
index 00ef1a7decf8ef3bfa591416487d81e885191213..e72e20d1068af718f77c22cf80c92fd872e42b15 100644 (file)
@@ -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) {
index 2929b9ca3975e4477b0140c7a9afd6e84727462e..66e788b0bd7a9d895a777aad174647ff5e2cce60 100644 (file)
 
 // 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 {}
 
index 31e4184b1877c42d39f35f577d2a85e530ed9f4c..ca8e8df711fcdafc76d519a89e9c3ad3cef8b96b 100644 (file)
 #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:
index 162b830fc14eadfeb842f018a0c38e4d9c5dacd0..c8e110a35015ebb58ad7861b3f9af4121f7918b7 100644 (file)
 #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:
index 7be292a3a334be384be4e5b26acfec16fefd1cbd..37e78f88e7b99b185be8d34e1e352a2d6af7827c 100644 (file)
 
 #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 {}
 
index feda44e5fb9a1de05aee4acb7e49328100940782..554d80cda9e2425d460ec2fe86071b9492ff1daa 100644 (file)
 #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 {}
 
index 6ef9b36812490e227b2ee6e1b64221bcc3649893..482d32a5b1cba4cabd9d025f11eee311ea8bc80a 100644 (file)
 #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
index 1860f473ae9105f7102b55834fb21cdbc900a0dd..f4636186d4c4e6e6241e6e12bd0f3266cce8e14b 100644 (file)
 
 #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;
index 2dc9c1ae10b94b3d6295e35c5675cf1916786693..56cb37551ffd6d35020a22c0f4e374589fda3ba3 100644 (file)
 
 #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;
   }
 
index ca1dd9bdf7b93e1af959eee36e9a29552eb0eb93..0b8ce139e0d5479562b25712c0f9d70d9cee4ee7 100644 (file)
 
 #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:
index 97e26469ba96588ab3a7d957b5774406b47d0ae6..8ce63c0ea5ba4f7471169a7e389583c0fdc1587d 100644 (file)
 #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:
index c449a79042c9dbbce484d0b98313b3a60b1af31e..9e80aff627f858d0170c11c5fa7c7df065fe500d 100644 (file)
 #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 {}
index b9063a58e03dd32910a47ab06c4e5fe2f10c3dae..e8672c68e95387b0ab3f2a5da8c6016df9279390 100644 (file)
 
 #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 {}
index 8504584f80c263916f240add49291a3dd2c2744b..ae952676e2801b5536fa9d573a658d200044714a 100644 (file)
 #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);
   }
index 91e7208a1d307472061e23744c050eccb93743db..58905771db67cbf2a1c52db48b29ddc13e856c7c 100644 (file)
 #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_))
   {
index d6b8415076b769715ba67b2953115e1123dc8f28..6d35e9ba7b7b9eb0dbd4d1026862107ca099bd2c 100644 (file)
@@ -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)
   {}
 };
index c65d01229c5f0477f53cba079db1ac870d6c993d..3f1ff9b00ab5588efd37a006178e6b0d636b8563 100644 (file)
  * 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)
   {}
 };
 
index ad0863f36aa05becb8bb92755abf040ad88ab9e2..949984b58002813c97314098a6332315613612dc 100644 (file)
  * 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 {
index f15bba1bff0356c5696ffa85e0750794eac0cf07..af223b94b394f27768374f9b7f783d8a33a11619 100644 (file)
 #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_)
   {
   }
 
index 7db57a51d05778bab931d0ea70b7d18c8d8a5ee2..721668c4b523ba5d4389a95cd740a217223a4aed 100644 (file)
 
 #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)
   {}
 };
 
index fdc46410519e96b952e95aea3cbf4c1e91dcf37f..232e97400dedb1bc12e3f7979588cff234547360 100644 (file)
@@ -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)
   {}
 };
 
index f609c4bc849bbded988e4d780f87ed9c31ca4eff..7af8f8f919ce7b0e4ba4610594153acd5a0c5b15 100644 (file)
 #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)
   { }
 
index 4d2c442bca954a1ef5fbe1d0f0d89e7ed586106e..03fbdae63d7a89330e2ef1669cc7318c87634b5e 100644 (file)
 
 #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 {}
index ad15fe998537c8d331545a9c6314dfce67e32c72..2e838b0bf7502eff078413fa7787a2b2fdcaeab7 100644 (file)
 #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)
index eaae9d0b16a965a3e814b62e48e2e91beff8e22f..a0713f7969c75c3376088b65bd6549b78d553369 100644 (file)
 
 #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 {}
 
index 5579c250a7928bbee44ea906e4436dc5ee487e77..851b70fb645e81832a0996ae7884b08702b0d788 100644 (file)
 
 #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),
index 07faee88bf486d4c87b6c0d3420f48a7dd2d63d5..c8c892f2e355536f1ec87037538eba9f296ef876 100644 (file)
  * 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";
index 2bc0fab78750593bba442d8a291b1a3ab5c11191..1eb3f567b331fd5cd77fcc07ffc7b06c406d05ff 100644 (file)
  * 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";
index 84db54bc4189a039f49ea085971006bd30cf7ff1..51892b8f1dcedf5fad364f726239166bca8c385b 100644 (file)
 
 #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 {}
 
index 0443dca292c756683112ffc271284f24cc2065f5..393bb8040468ff83185c3ea2a56ff15a5b93d00a 100644 (file)
 #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 { }
index 30962f601d38c161db8f9cda0317c5af99c41bd8..eeb8bac23c63185e197645b14246c307e0d1519a 100644 (file)
@@ -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) {
   }
 
index 597b1039f4c71872866f39be3d1c9acefc148cf5..8a65f27a8305a849015533d52eb241cf8449b777 100644 (file)
 #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)
   { }
   
index 8cd9c5d3f29211b94fe60d0c29e44c99b8d5863c..8bd21c863caa8c64bdaf54844ad6529b4c41af11 100644 (file)
 #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:
index 1e50e43cd4285a69bb8c4bbbf3480503611ddcf6..db6ffcd7db6f6a71c9f9b006f2d04b63d08bf436 100644 (file)
 #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)
   {}
 
index 81464ff61b3377d08ea3fd353902d365e26f1dad..85277492a4d76da68ac3179d33670be658274286 100644 (file)
 #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 {}
index a872f7ac366b56f39576773df1e8f4808f5c2bec..56ab8c5c015930aded7ac4794a931116623be2e5 100644 (file)
 #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),
index 6709a26031a2895537f56c7f932464ef0f05646e..2ee68de71e999356ca84f93da74225b5304f36fc 100644 (file)
 #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),
index be09e54b833163a81b031ebbf92edf5202628334..068849875b78d0239d6be762b9e046537c9d96b5 100644 (file)
 
 #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:
index 5a7936965a81d1fe43af53516c4c4fdc41e235d6..023fbdcd9d3709a8c52432361c7db656381c561e 100644 (file)
 #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)
   { }
 
index 32dc5429ceac836eac970a402ef8764f003ac9b0..bce11d3fc6acb522217e559796b5155e6375128c 100644 (file)
@@ -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 {}
 
index 35681cb932a1558fc0e257842910b83ba241e4f0..c16cbf3b2f968fc850463a49061e6b3c5b696ed9 100644 (file)
 
 #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 {}
index 8e5ae95a2f4efbfc0feea24d6d2c995b16328ce3..c7c9d20d5e1cd8371fd3a6d59044f97e2045cfc6 100644 (file)
 
 #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)
index f59816d0b67d73dfce967e86468cb898bba9b136..73f778cebd97c3400e6db9f11091bb49140a2bdf 100644 (file)
 /*
  * 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() {}
index 5e868add1400bd57ee1c1c1f4f37ef613f908648..4e1f15e33ba734ee851ff1ed60d71a857c3fcae6 100644 (file)
 
 #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 {}
 
index 1b2e511629b1264051fb3918c8aa87c59c03aee9..ebff1812ebcd005ca26904222471c3dcd36be9f8 100644 (file)
 #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_),
index ff79842867b26eb5340255c33dc3718199e72c24..3433c2379a902dce9738f9ab5364d1a01b351863 100644 (file)
@@ -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 {
index 475d889cc0e90ed703fbd5cba8431a710a4c2106..a76b07a4cafb18a4d75568937adde69406d9eeec 100644 (file)
 #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),
index 62215378179f4cf716c4bf2f860e91f2297d2841..e1cdb78e06cb316ffbc7db5dca14b14506566409 100644 (file)
 #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 {
index 6dc46a89219cc20b4ede12b04799b99260e75031..6cdc9d60e4922a2952835254aa4f32dd4a795f07 100644 (file)
 #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 {
index 7fc55b62b6eaa10908ac4bd0a76094482d18731b..7a5c382293ef96073457033899d34ca34b29e3e4 100644 (file)
 #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);
   }
 
index e07dca836cee17d209c30d656c77f49054d4f9b5..dea3c501f8cdc7ab6c053213e24dc93c27da37cb 100644 (file)
 #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 {
index 37d70af341c6739c3aca966a75396431b92285c7..29516e06b50578032e4bf5d29c622d873996031e 100644 (file)
 #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),
index 3ba555f89292bc659657f14b7b8a8f6884ab6a5e..1f5f7abe22305a6cfe786c8c500158323f4dbc6a 100644 (file)
@@ -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
index 06e47ea3ce4ab45f67905ae60eeda4b8654d1e50..2a5b37f2443b7076d7974b5683c094d681273df6 100644 (file)
@@ -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() {}
index 6573aa3101caf116c096270ad8a33cf0e6124faa..9adb32153e377104d35c910bb9d83a5b8be972b3 100644 (file)
 // 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) {
index f0149650b2871fb740963ec252ab092e95faf1ec..7ff35ba79ef10c3e31326d91ee882bf12227f093 100644 (file)
 #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:
index faa360760b0958eb139c48cd07f8c23a388fc1ca..ce773fae32dd796a316fabaa8825a4ae11e277cc 100644 (file)
 
 #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) {}
index 30e11ceee69bfbc8436a07b440215d4da8b7c1a3..2dd0931248bda4007f756030c8f685b654f61615 100644 (file)
 
 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),
index b4dc9d8595f8f9705ba898ffb0666b24ae5b4ab9..21422dd2f4810134e49023775a1299d336f10148 100644 (file)
  *
  */
 
-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) {
 
index 849a0bc7f1f08fd6b13b4ebd4a7ae243874fbbdc..e57a38ccd5391316a0c394ce04c4ed0e3d954536 100644 (file)
 
 #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) {}
index 0c10e9409dca98565b17b2c63e0ab09b0d18aa8c..3f39f762900edd87103184f7466950fcbcd52053 100644 (file)
  * 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) {}
index 7384c4f499ed1a1ce340b2a064d2c5ef58c9737e..c1380af5f799c146c96793ae86a0e025a21213b5 100644 (file)
  * 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 {}
index 6b2694b7d11eda6157303ee47e04e526a7886977..83cfc28ebe75aed26766335823786b3a7efc13d7 100644 (file)
  * 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 {}
index 50ad405efe8a8f47b20a24239b1ab5da44f7e07d..cb411df34231d1d4c1256638eb65d6481bd25b62 100644 (file)
@@ -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"; }
index 48980ce1941c0ded3d35e48f74f0d46cf4264ce9..336a61d5b6bd995c6a656db24097c46b18726cc7 100644 (file)
 #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);
   }
index 9813db344c945fe5598fbaa62db09729d77c2911..4025c8f0d559223e6d7082363c73951f3304652a 100644 (file)
 
 #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)  {
index b5235ff9e2e306fd1754bf6ec93f46bb45b660e4..5cbf6569bc91ab9576481f48daa7a71edd45df09 100644 (file)
  * 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);
index 3e3d91321f261c813e1e65fa1549a95f070ecb38..79c13a19e64ca3e590cbf9085859ea9d7ad6366f 100644 (file)
 
 #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)
     {}
 
index 1a27bc391598020517fa4fe71d71c529e590213d..77864cceabafec8a89def7d29fd002a6f28d3b60 100644 (file)
 
 #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)
     {}
 
index 8b718c622820b4e1f19744b17fd3447929975e9f..dc0d6bfb98d2478571f4f2078104ec8b701d7f41 100644 (file)
 
 #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)
     {}
 
index 70768a1c72b98a3e6835c214a6530be6de54ce44..fe561ab068e1e1291272796db51ef10c4e419136 100644 (file)
  * 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) {
index 3730cd339941cffdd3a8e904b0198edfdc56f161..ac4152567fad70f3cb07e6116448725f9c159075 100644 (file)
  * 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),
index ca414bb7282474b8c5422f904a2c03e47c5067dd..f48e436349cdbaae893382b842b8e75a943311aa 100644 (file)
@@ -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)
     {}
 
index 278f184b8b5364abd5c9be6abc8b9bc11225aa6c..dd7b62bc4416a1bfc3b1021268b30cc8e8e90a66 100644 (file)
 #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);
   }
index 50d0a140864bfc487ab9e41b87ff50e2471f7689..4da8aac5128bb15700a7ea03170cf2c11d681a1b 100644 (file)
 
 #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),
index c06f8d0231da77e0fe275b2c642faaf18cb82f06..68f2219fead1d76f77ef40dffeca441afd7b118a 100644 (file)
 
 #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()
index 106443798d61c5e790c1543b022902f049c16b49..ce8312dcaeed9349a0ba90add7ba55b8a6b2afec 100644 (file)
 #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 {}
index 91923cff9dcf97d26609457a42cee1a36dcb90d3..1764c23f1b555086d9930b4bf05f66d54a78ae99 100644 (file)
 
 #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),
index a6bdef7a65a8226d7791066d074d43d6b89ec76c..9a7df150ee83f3448e8769dabfb7e218504734bb 100644 (file)
 
 #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),
index f1c2a60db55ff496453b9db0ea8553d3baa87b5c..25487488a62f9b4ebecacc55ad93a7b118448505 100644 (file)
@@ -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() << "("
index 3fd98fe40ee930e1e6b67268eb1e81f00333133a..1728cf8e565a9acee28df7bb2bc6ad78ac7c8c3e 100644 (file)
 #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 {}
index 6c26aadf302346275dae74d891dc43b65c28279b..daacad60406f2eb48d04eac577ac9992a94c228e 100644 (file)
  * 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),
index d8eea1471953973dbdd2678d448be8c408a10c53..239864846586aa720ddce480da25c0d4ec2afb84 100644 (file)
  *
  */
 
-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),
index 1610fd1086629c9441e12310ad6bcc121c1c6433..69714ccc4f2e76b41cadc4b798e77f469bec2973 100644 (file)
  * 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),
index b32717808ed42d41bbe57499d5e169631207aa0c..96705d0f51daf85cff5f5903f39ecbc3e3527fb6 100644 (file)
  * 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) {}
index a487dd1700e77cdb5c3288a2a344fe70eaabe088..f46ff17475611a6a9392a1555a3f9b343811da4b 100644 (file)
  * 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 {}
index 96ec1ae622d50e340f35577f0b28ff883252dc4c..28e1d2a3bf32e40709ff22735ca9ec1c4a95969a 100644 (file)
@@ -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 {}
index 94d7164307523ef952b1bdfffc8888af3fe72f0d..5cab78d59d24dbe015bcd28334c55e74591f1bbd 100644 (file)
 
 #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) {}
 
index 7c49156db38542571e20b80f22273ad6a8eae5b6..3988318a5a8935500fd68dfede4b13ec5168c3f2 100644 (file)
 #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)
index 2080e31109f1891d6081d35f3ffb115317ead198..2026855300107fb89ca23ae9368f0eecc1559ac5 100644 (file)
 
 #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 {}
index 88fedb29a185ed6fca8f751717844c212e10f947..6de6dac6ff6268f29c460c838d89f8e3240e492f 100644 (file)
 
 #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 {}
 
index 8ad344ef559d8ef13cf19ce93ed6cb7604d41d0a..8a6ba7d8e3901ac4c0bbb30f579fdb7bc9631e16 100644 (file)
 #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);
index 13b13684cabdc5aaac9a630b5cc9274420914312..2e83a464a6adfa40fdc8aa12dae55ee8e7fa7316 100644 (file)
 
 #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) {
index a0eb2a5e33d1552833c83794f81e2b7a25449b70..344eae5516b35c859a4ff2c0a65fa791d73892e6 100644 (file)
 #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) {}
 
index c0f83bfc52686d8b21f9145278a8d94b22cef910..9d983d5edb61f339fb859023d13108e58f2ea822 100644 (file)
 
 #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 {}
index 74228cfbb66e3c4db144e44931d724c29b668813..b858abe414bbd10371854c9e6f98697302696a8d 100644 (file)
 #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) {}
index 084044c3862f4f0eedadb9620319158c4aee53ea..565f3f406e253c37fc0dba557306a31efaacd261 100644 (file)
@@ -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:
index 392c931242b965c9bdde4699c6d4969b4f77322a..71f2d7fea555217a72e02faf2da085a0db4ee555 100644 (file)
 #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);
index b925b31afdfa29e5f23d99713b6d4334bed123c1..59738c8d293b5cacea4f1185dc5407ab85ccaba4 100644 (file)
 #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;
index b8a7b75e145a8572973bbf0254fe2f57bc4709ce..5905c6b6a7574005ffa9803196c6c6792bd0c2d9 100644 (file)
 #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)
   { }
 
index bda6aef9cb938083ad29c7a49ef2cccfd929e6b1..56243d10a92e96aba5445f15db26fcdda77510f1 100644 (file)
 
 #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)
   { }
 
index e0ace85c50e3ec4190dda981b049b68806a1ebf9..1300ba6d92e71e905f8981f56ef7a5c5ed646036 100644 (file)
 #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),
index d902e445e525c084859e8752bd590b80d602265f..3532e3eb4f6a3f4a19eee7ebca7ad8efabd01936 100644 (file)
@@ -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() {
index 6ffc1f2045a952eeeb84c130d375e86c55157bfb..b0005ff470bbdd2c268464f527024997312cf075 100644 (file)
@@ -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