]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: add factory method to correctly construct smart_ptr
authorPatrick Donnelly <pdonnell@redhat.com>
Mon, 30 Jul 2018 17:03:23 +0000 (10:03 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 15 Aug 2018 20:36:18 +0000 (13:36 -0700)
This is to avoid easy leaks of the form:

    boost::intrusive_ptr(new M*(...));

where a ref is leaked because constructing the intrusive_ptr adds a ref.

It is expected that eventually all constructors move to protected/private so
that the message's factory is the only way to build a new message (safely).

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
155 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.cc
src/msg/Message.h
src/tools/ceph-dencoder/ceph_dencoder.cc
src/tools/ceph-dencoder/types.h

index 62b0ba749777f18717e1aa75cc80880e8868501c..96397fd7a3fb4677cdaca51401e139da599513ad 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-struct MAuth : public PaxosServiceMessage {
+class MAuth : public PaxosServiceMessage {
+public:
+  typedef boost::intrusive_ptr<MAuth> ref;
+  typedef boost::intrusive_ptr<MAuth const> const_ref;
+  using factory = MessageFactory<MAuth>;
+  friend factory;
+
   __u32 protocol;
   bufferlist auth_payload;
   epoch_t monmap_epoch;
index d81ddbf29ddcc5121014fc90958a5f7201eed5df..5fe8869adaf0793a262701ac701fe6be99521e38 100644 (file)
 #include "msg/Message.h"
 #include "common/errno.h"
 
-struct MAuthReply : public Message {
+class MAuthReply : public Message {
+public:
+  typedef boost::intrusive_ptr<MAuthReply> ref;
+  typedef boost::intrusive_ptr<MAuthReply const> const_ref;
+  using factory = MessageFactory<MAuthReply>;
+  friend factory;
+
   __u32 protocol;
   errorcode32_t result;
   uint64_t global_id;      // if zero, meaningless
index 6d8ea9eb6861e7b197e6d1255f0b9113a49a811a..3d11aac9e289da1a6366e56501681a639628b077 100644 (file)
 #include "messages/MOSDPeeringOp.h"
 
 class MBackfillReserve : public 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;
   static const int COMPAT_VERSION = 4;
 public:
index e8542424467fd6411355932b3dd4d7dcc83efbde..3f0f953c53971bc12b29afd2188a019d29006126 100644 (file)
 #include "mds/mdstypes.h"
 
 class MCacheExpire : public Message {
-  __s32 from;
-
 public:
   typedef boost::intrusive_ptr<MCacheExpire> ref;
   typedef boost::intrusive_ptr<MCacheExpire const> const_ref;
+  using factory = MessageFactory<MCacheExpire>;
+  friend factory;
+private:
+  __s32 from;
+
+public:
   /*
     group things by realm (auth delgation root), since that's how auth is determined.
     that makes it less work to process when exports are in progress.
index 07692a7263fff98d8da3315440eb98a65e13d194..1cd8b87819c0c2a0c9e990b392539186faf3d915 100644 (file)
 
 
 class MClientCapRelease : public Message {
+public:
+  typedef boost::intrusive_ptr<MClientCapRelease> ref;
+  typedef boost::intrusive_ptr<MClientCapRelease const> const_ref;
+  using factory = MessageFactory<MClientCapRelease>;
+  friend factory;
+
+private:
   static const int HEAD_VERSION = 2;
   static const int COMPAT_VERSION = 1;
  public:
-  typedef boost::intrusive_ptr<MClientCapRelease> ref;
-  typedef boost::intrusive_ptr<MClientCapRelease const> const_ref;
 
   struct ceph_mds_cap_release head;
   vector<ceph_mds_cap_item> caps;
index 57a21bae03d86aa3ffed8c861fe3a6bba9556277..b3f089610679c28fb0076657771070630792dc0f 100644 (file)
 #include "include/ceph_features.h"
 
 class MClientCaps : public Message {
+public:
+  typedef boost::intrusive_ptr<MClientCaps> ref;
+  typedef boost::intrusive_ptr<MClientCaps const> const_ref;
+  using factory = MessageFactory<MClientCaps>;
+  friend factory;
+private:
+
   static const int HEAD_VERSION = 11;
   static const int COMPAT_VERSION = 1;
 
  public:
-  typedef boost::intrusive_ptr<MClientCaps> ref;
-  typedef boost::intrusive_ptr<MClientCaps const> const_ref;
-
   static const unsigned FLAG_SYNC              = (1<<0);
   static const unsigned FLAG_NO_CAPSNAP                = (1<<1); // unused
   static const unsigned FLAG_PENDING_CAPSNAP   = (1<<2);
index b127c90e1fb63b5617c206a71e820355a1adc4d6..4dc8b5247df643bde836651a86bff3e331917373 100644 (file)
@@ -24,6 +24,8 @@ class MClientLease : public Message {
 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;
   std::string dname;
index 297d2df56a8bd99c43c60e6ff84652acabc67422..701f2155cf2daa60bf3747cade7e9724cfe50eb6 100644 (file)
@@ -3,7 +3,13 @@
 
 #include "msg/Message.h"
 
-struct MClientQuota : public Message {
+class MClientQuota : public Message {
+public:
+  typedef boost::intrusive_ptr<MClientQuota> ref;
+  typedef boost::intrusive_ptr<MClientQuota const> const_ref;
+  using factory = MessageFactory<MClientQuota>;
+  friend factory;
+
   inodeno_t ino;
   nest_info_t rstat;
   quota_info_t quota;
index 6740fbb1d40ec05a18fa076bce52713f235b0389..42e611131b8971dca455a1f0cb1e2fe2fb771359 100644 (file)
 
 
 class MClientReconnect : public Message {
-
-  const static int HEAD_VERSION = 3;
-
 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;
+
+public:
   map<inodeno_t, cap_reconnect_t>  caps;   // only head inodes
   vector<ceph_mds_snaprealm_reconnect> realms;
 
index 34a017ffb092c1488b1710003cd4329eb2320936..0892c13caa8344a9ec2e7aa07069c4e834a3baea 100644 (file)
@@ -254,16 +254,18 @@ struct InodeStat {
 
 
 class MClientReply : public Message {
-  // reply data
 public:
   typedef boost::intrusive_ptr<MClientReply> ref;
   typedef boost::intrusive_ptr<MClientReply const> const_ref;
+  using factory = MessageFactory<MClientReply>;
+  friend factory;
+
+  // reply data
   struct ceph_mds_reply_head head {};
   bufferlist trace_bl;
   bufferlist extra_bl;
   bufferlist snapbl;
 
- public:
   int get_op() const { return head.op; }
 
   void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = e; }
index f7771d133ffb1cb4c8bb58887a1484f132d1cedd..98533d3622405d8874bf4fe79206b53cf074653f 100644 (file)
 // metadata ops.
 
 class MClientRequest : public Message {
+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;
   static const int COMPAT_VERSION = 1;
 
 public:
-  typedef boost::intrusive_ptr<MClientRequest> ref;
-  typedef boost::intrusive_ptr<MClientRequest const> const_ref;
   mutable struct ceph_mds_request_head head; /* XXX HACK! */
   utime_t stamp;
 
index 9a4403f4a7c96c886be85f5c19b121818133010e..79d62989bcd73eb9b8f053ffd56fc77fa5155980 100644 (file)
 #include "msg/Message.h"
 
 class MClientRequestForward : public Message {
+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;
   int32_t num_fwd;
   bool client_must_resend;
index 3589d291e6960159fab06cb18ef027931bd79121..816a8f83b3048ee71d984372271e8069bc94559d 100644 (file)
 #include "mds/mdstypes.h"
 
 class MClientSession : public Message {
+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;
   static const int COMPAT_VERSION = 1;
 
 public:
-  typedef boost::intrusive_ptr<MClientSession> ref;
-  typedef boost::intrusive_ptr<MClientSession const> const_ref;
   ceph_mds_session_head head;
 
   std::map<std::string, std::string> metadata;
index b7b8864c5c310eab4d559d3a821ab052744a8cb2..920a8b6ba21a432f5a606ef73a4f580c03822cd5 100644 (file)
 
 #include "msg/Message.h"
 
-struct MClientSnap : public Message {
+class MClientSnap : public Message {
+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;
   bufferlist bl;
index e0773181be93cfdeff14ae64534d8f41fd54d04a..3f7d73999cf2cea7f85cc57653e0d1c72b9ee567 100644 (file)
 #include "msg/Message.h"
 
 class MCommand : public Message {
- public:
+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;
index cba70cc834bfd05fc22509ff1d3a5f84f68457cb..3390aa8d787745322897b13da5303930d21ed050 100644 (file)
 #include "MCommand.h"
 
 class MCommandReply : public Message {
- public:
+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;
   
index 683a433bcb386de8c4997250923aed87b08167c3..1a0aa8d1f28cb8dacd539375979cd5127c31d758 100644 (file)
@@ -5,7 +5,13 @@
 
 #include "msg/Message.h"
 
-struct MConfig : public Message {
+class MConfig : public Message {
+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;
   static const int COMPAT_VERSION = 1;
 
index f1bc8e423b5dd49b991ea39a7423ef849d80a5e6..3d17669759dfbab603d3845af5918aa537db4b65 100644 (file)
@@ -29,8 +29,11 @@ struct xio_reg_mem {};
 typedef void (*mdata_hook_func)(struct xio_reg_mem *mp);
 
 class MDataPing : public Message {
-
- public:
+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;
   static const int COMPAT_VERSION = 1;
index 3799f393b61444d2c3d2be1f5eeacc667fe2a4ef..018e2b3b90da9804879f02c9256856d493f2e23f 100644 (file)
 #include "msg/Message.h"
 
 class MDentryLink : public Message {
+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;
   dirfrag_t dirfrag;
   string dn;
   bool is_primary = false;
 
  public:
-  typedef boost::intrusive_ptr<MDentryLink> ref;
-  typedef boost::intrusive_ptr<MDentryLink const> const_ref;
   dirfrag_t get_subtree() const { return subtree; }
   dirfrag_t get_dirfrag() const { return dirfrag; }
   const string& get_dn() const { return dn; }
index 613c1077bbb0dea71745486b354fe0ff89efcd44..ef2faa5804238734c34c0e543cd0cf7e988067ee 100644 (file)
 #include "msg/Message.h"
 
 class MDentryUnlink : public Message {
+public:
+  typedef boost::intrusive_ptr<MDentryUnlink> ref;
+  typedef boost::intrusive_ptr<MDentryUnlink const> const_ref;
+  using factory = MessageFactory<MDentryUnlink>;
+  friend factory;
+private:
+
   dirfrag_t dirfrag;
   string dn;
 
  public:
-  typedef boost::intrusive_ptr<MDentryUnlink> ref;
-  typedef boost::intrusive_ptr<MDentryUnlink const> const_ref;
   dirfrag_t get_dirfrag() const { return dirfrag; }
   const string& get_dn() const { return dn; }
 
index d15f24e1ef180f6cabe4f468ea8fea48528d419d..4ecb79d649d222cd6e8d87774d5f283fdfa8067f 100644 (file)
@@ -22,6 +22,9 @@ class MDirUpdate : public Message {
 public:
   typedef boost::intrusive_ptr<MDirUpdate> ref;
   typedef boost::intrusive_ptr<MDirUpdate const> const_ref;
+  using factory = MessageFactory<MDirUpdate>;
+  friend factory;
+
   MDirUpdate() : Message(MSG_MDS_DIRUPDATE) {}
   MDirUpdate(mds_rank_t f,
             dirfrag_t dirfrag,
index a1004f2e3252b1cff585161d43e946a11d29383e..d035253c44deff432a272ee31837fa004388330a 100644 (file)
 
 
 class MDiscover : public Message {
+public:
+  typedef boost::intrusive_ptr<MDiscover> ref;
+  typedef boost::intrusive_ptr<MDiscover const> const_ref;
+  using factory = MessageFactory<MDiscover>;
+  friend factory;
+private:
+
   inodeno_t       base_ino;          // 1 -> root
   frag_t          base_dir_frag;
 
@@ -33,8 +40,6 @@ class MDiscover : public Message {
   bool want_xlocked = false;
 
  public:
-  typedef boost::intrusive_ptr<MDiscover> ref;
-  typedef boost::intrusive_ptr<MDiscover const> const_ref;
   inodeno_t get_base_ino() const { return base_ino; }
   frag_t    get_base_dir_frag() const { return base_dir_frag; }
   snapid_t  get_snapid() const { return snapid; }
index 8d86f267e44b8f4f2c70abff5f12369ebe41d4be..bc15d7da750cc82e41763c9632399d3502aa6ef1 100644 (file)
  */
 
 class MDiscoverReply : public Message {
-
+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;
 
   // info about original request
@@ -83,8 +88,6 @@ class MDiscoverReply : public Message {
   mds_rank_t dir_auth_hint = 0;
 
  public:
-  typedef boost::intrusive_ptr<MDiscoverReply> ref;
-  typedef boost::intrusive_ptr<MDiscoverReply const> const_ref;
   __u8 starts_with = 0;
   bufferlist trace;
 
index 82d64935fab9aa987d75759c4bb11ffe441ac92c..f538dab256d65eaacb6299096851a3ec582ce0e9 100644 (file)
 
 
 class MExportCaps : public Message {
+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;
   static const int COMPAT_VERSION = 1;
  public:  
-  typedef boost::intrusive_ptr<MExportCaps> ref;
-  typedef boost::intrusive_ptr<MExportCaps const> const_ref;
   inodeno_t ino;
   bufferlist cap_bl;
   map<client_t,entity_inst_t> client_map;
index 2ff1643661f32cd4c046ae965a5feb9719300fcc..a6b800043130edc44e65d49801085c84cda5df95 100644 (file)
 
 
 class MExportCapsAck : public Message {
- public:  
+public:  
   typedef boost::intrusive_ptr<MExportCapsAck> ref;
   typedef boost::intrusive_ptr<MExportCapsAck const> const_ref;
+  using factory = MessageFactory<MExportCapsAck>;
+  friend factory;
+
   inodeno_t ino;
   bufferlist cap_bl;
 
index 29e9fa7fc04338b9d64e2c1f82cf3401cedfa177..90d58cd1cc203504c6742bd34f8048d0258ccf91 100644 (file)
 
 
 class MExportDir : public Message {
- public:  
+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;
   vector<dirfrag_t> bounds;
index ff076eca5d2acee418ae89e37d449ffb2f12cbec..9aa49f516ec9e641217f4e8d50cf87e7573db0bb 100644 (file)
@@ -22,6 +22,9 @@ class MExportDirAck : public Message {
 public:
   typedef boost::intrusive_ptr<MExportDirAck> ref;
   typedef boost::intrusive_ptr<MExportDirAck const> const_ref;
+  using factory = MessageFactory<MExportDirAck>;
+  friend factory;
+
   dirfrag_t dirfrag;
   bufferlist imported_caps;
 
index 96892a13a2879f32de21a63462a9a21c839a0e9b..c63b4e9d8a7cdd28866c610732550f391f4e6315 100644 (file)
 #include "include/types.h"
 
 class MExportDirCancel : public Message {
+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;
 
  public:
-  typedef boost::intrusive_ptr<MExportDirCancel> ref;
-  typedef boost::intrusive_ptr<MExportDirCancel const> const_ref;
   dirfrag_t get_dirfrag() const { return dirfrag; }
 
   MExportDirCancel() : Message(MSG_MDS_EXPORTDIRCANCEL) {}
index cb581d207db9433df483e2a20f001c1beac1288c..1b6f41815c093af843ab1525a5382679fa9a7809 100644 (file)
 #include "include/types.h"
 
 class MExportDirDiscover : public Message {
+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;
   dirfrag_t dirfrag;
   filepath path;
 
  public:
-  typedef boost::intrusive_ptr<MExportDirDiscover> ref;
-  typedef boost::intrusive_ptr<MExportDirDiscover const> const_ref;
   mds_rank_t get_source_mds() const { return from; }
   inodeno_t get_ino() const { return dirfrag.ino; }
   dirfrag_t get_dirfrag() const { return dirfrag; }
index c6bc716f9c574f501a731a3c8cb91beefa2b5c40..ab76e7a37e805ae3fe701695ed9268bbbda6ed55 100644 (file)
 #include "include/types.h"
 
 class MExportDirDiscoverAck : public Message {
+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;
   bool success;
 
  public:
-  typedef boost::intrusive_ptr<MExportDirDiscoverAck> ref;
-  typedef boost::intrusive_ptr<MExportDirDiscoverAck const> const_ref;
   inodeno_t get_ino() const { return dirfrag.ino; }
   dirfrag_t get_dirfrag() const { return dirfrag; }
   bool is_success() const { return success; }
index 6f7bb1aa2f8a588bec75300c8fd85970bc9209be..7c6f21d30cabb0b8b2833b4c890ea2fe14d8d73d 100644 (file)
 #include "msg/Message.h"
 
 class MExportDirFinish : public Message {
+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;
   bool last;
 
  public:
-  typedef boost::intrusive_ptr<MExportDirFinish> ref;
-  typedef boost::intrusive_ptr<MExportDirFinish const> const_ref;
   dirfrag_t get_dirfrag() const { return dirfrag; }
   bool is_last() const { return last; }
   
index 21142a0a83f59ba5d2e329f10978e5809ab8c61e..7d4b7da06ca1761ae5a5f65e1422df5f3c57ffee 100644 (file)
 #include "msg/Message.h"
 
 class MExportDirNotify : public Message {
+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;
   bool ack;
   pair<__s32,__s32> old_auth, new_auth;
   list<dirfrag_t> bounds;  // bounds; these dirs are _not_ included (tho the dirfragdes are)
 
  public:
-  typedef boost::intrusive_ptr<MExportDirNotify> ref;
-  typedef boost::intrusive_ptr<MExportDirNotify const> const_ref;
   dirfrag_t get_dirfrag() const { return base; }
   pair<__s32,__s32> get_old_auth() const { return old_auth; }
   pair<__s32,__s32> get_new_auth() const { return new_auth; }
index 64c4a5272fde1b96b10d2332dc23a790b2e9359b..eea1ca5a60382555c8fef58cf37b6330cafbfd71 100644 (file)
 #include "msg/Message.h"
 
 class MExportDirNotifyAck : public Message {
+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;
   pair<__s32,__s32> new_auth;
 
  public:
-  typedef boost::intrusive_ptr<MExportDirNotifyAck>ref;
-  typedef boost::intrusive_ptr<MExportDirNotifyAck const> const_ref;
   dirfrag_t get_dirfrag() const { return dirfrag; }
   pair<__s32,__s32> get_new_auth() const { return new_auth; }
   
index 8eb0eda78c8f236145deb8eab0d02b234d75bdb0..9c2ea6f9598a2ba0e0b4dd556b19c7d1011bd31f 100644 (file)
 #include "include/types.h"
 
 class MExportDirPrep : public Message {
-  dirfrag_t dirfrag;
- public:
+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;
+ public:
   bufferlist basedir;
   list<dirfrag_t> bounds;
   list<bufferlist> traces;
index 94a36bdcaa49f5dd4cc4c86c7847dde3e92c78db..7e8c9d4643232c2eb95b0303c2b9ed40462e1b80 100644 (file)
 #include "include/types.h"
 
 class MExportDirPrepAck : public Message {
+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;
   bool success = false;
 
  public:
-  typedef boost::intrusive_ptr<MExportDirPrepAck> ref;
-  typedef boost::intrusive_ptr<MExportDirPrepAck const> const_ref;
   dirfrag_t get_dirfrag() const { return dirfrag; }
 
   MExportDirPrepAck() {}
index 1019582472991a90f01269b6170c4b5276a9e6e2..67ab3506a01e70cba1b4ababc806a655e8a6fd82 100644 (file)
 #include "include/ceph_features.h"
 
 class MFSMap : public Message {
- public:
+public:
+  typedef boost::intrusive_ptr<MFSMap> ref;
+  typedef boost::intrusive_ptr<MFSMap const> const_ref;
+  using factory = MessageFactory<MFSMap>;
+  friend factory;
+
   epoch_t epoch;
   bufferlist encoded;
 
index 347976a62e0a484a3c7ffc51c4ab6821cfba58b3..a5c06f460caea9f494cc5372a9f82a96d206b20c 100644 (file)
 #include "include/ceph_features.h"
 
 class MFSMapUser : public Message {
- public:
+public:
+  typedef boost::intrusive_ptr<MFSMapUser> ref;
+  typedef boost::intrusive_ptr<MFSMapUser const> const_ref;
+  using factory = MessageFactory<MFSMapUser>;
+  friend factory;
+
   epoch_t epoch;
 
   version_t get_epoch() const { return epoch; }
index 93949c6064da0be6de964e082fa5eab9fad90e98..9f681a34935705587b9f873a23c1eb58c359226c 100644 (file)
 #include "include/encoding.h"
 #include "include/stringify.h"
 
-struct MForward : public Message {
+class MForward : public Message {
+public:
+  typedef boost::intrusive_ptr<MForward> ref;
+  typedef boost::intrusive_ptr<MForward const> const_ref;
+  using factory = MessageFactory<MForward>;
+  friend factory;
+
   uint64_t tid;
   uint8_t client_type;
   entity_addrvec_t client_addrs;
index 73d8d08d4091a8b18f83746a38e74f4727b37675..57d30871fbc410a63cc01d6829e95e93d8ff5a3e 100644 (file)
@@ -8,6 +8,9 @@ class MGatherCaps : public Message {
 public:
   typedef boost::intrusive_ptr<MGatherCaps> ref;
   typedef boost::intrusive_ptr<MGatherCaps const> const_ref;
+  using factory = MessageFactory<MGatherCaps>;
+  friend factory;
+
 
   inodeno_t ino;
 
index d84209e36b4fae73a81ea73c3c01fa46dd6e8ad8..7ef0f6beff8b181ea3e13e319191c4bbef9e4d02 100644 (file)
 #include "msg/Message.h"
 
 class MGenericMessage : public Message {
+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;
 
index e489276be3991cb0571f7a3a675a8552157f5243..d7add127e18fcc2009699eb4eabd533e04d7d044 100644 (file)
@@ -5,7 +5,13 @@
 
 #include "msg/Message.h"
 
-struct MGetConfig : public Message {
+class MGetConfig : public Message {
+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;
   static const int COMPAT_VERSION = 1;
 
index 73f0121ba77de00ac3ede0086d1aeae64d8cef21..a21c6eb5c4b081f78b634e8fc92b03e4e52f0995 100644 (file)
 
 class MGetPoolStats : public 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;
 
index 829ed197e8bfac8a54820db74181670da213eb98..af4834b678aadb1dc0d605951966a404ffb1ac30 100644 (file)
 
 class MGetPoolStatsReply : public 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;
 
index 3d7f98dd02c97394ed700fd22fa324546870bfc3..1b7293e8fb4e24ac83fdf06bd2c7cdbf99b05642 100644 (file)
 #include "common/DecayCounter.h"
 
 class MHeartbeat : public Message {
+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;
   __s32        beat = 0;
   map<mds_rank_t, float> import_map;
 
  public:
-  typedef boost::intrusive_ptr<MHeartbeat> ref;
-  typedef boost::intrusive_ptr<MHeartbeat const> const_ref;
   const mds_load_t& get_load() const { return load; }
   int get_beat() const { return beat; }
 
index a5e5c541652fa567d8a051e421a86a291dcd0f60..e2fc76c72b84e79c9c09506f39538d1bdd3a732c 100644 (file)
 #include "msg/Message.h"
 
 class MInodeFileCaps : public Message {
+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;
   __u32     caps = 0;
 
  public:
-  typedef boost::intrusive_ptr<MInodeFileCaps> ref;
-  typedef boost::intrusive_ptr<MInodeFileCaps const> const_ref;
 
   inodeno_t get_ino() const { return ino; }
   int       get_caps() const { return caps; }
index 4b992ff1bc8bd5d9862debc032e082be43ad6632..002cd98f9a041516ce63c2f6ed0b42e474ed4380 100644 (file)
 #include "mds/SimpleLock.h"
 
 class MLock : public Message {
+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
   mds_rank_t  asker = 0;  // who is initiating this request
   metareqid_t reqid;  // for remote lock requests
@@ -31,9 +37,6 @@ class MLock : public Message {
   bufferlist lockdata;  // and possibly some data
   
 public:
-  typedef boost::intrusive_ptr<MLock> ref;
-  typedef boost::intrusive_ptr<MLock const> const_ref;
-
   bufferlist& get_data() { return lockdata; }
   const bufferlist& get_data() const { return lockdata; }
   int get_asker() const { return asker; }
@@ -43,7 +46,7 @@ public:
   int get_lock_type() const { return lock_type; }
   const MDSCacheObjectInfo &get_object_info() const { return object_info; }
   MDSCacheObjectInfo &get_object_info() { return object_info; }
-  
+
   MLock() : Message(MSG_MDS_LOCK) {}
   MLock(int ac, mds_rank_t as) :
     Message(MSG_MDS_LOCK),
index 1d24c66be6aba3a7ed2831c187425abf7dc1c190..01e56418352eecc4280b6dd55e4aaf709a67ed6d 100644 (file)
 
 class MLog : public 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;
   
index 24db185dbc1ec383b919cd365e0eab72322f6529..91f74e9ac297457cc4489172db894cc7efe0694b 100644 (file)
 
 class MLogAck : public Message {
 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;
index 036c6d5a991e4972e99038189ac2f1f683aa08ff..a306371e5ba16ce5cfc3d944ebce167b1b83addd 100644 (file)
@@ -180,6 +180,12 @@ WRITE_CLASS_ENCODER(MDSHealth)
 
 
 class MMDSBeacon : public PaxosServiceMessage {
+public:
+  typedef boost::intrusive_ptr<MMDSBeacon> ref;
+  typedef boost::intrusive_ptr<MMDSBeacon const> const_ref;
+  using factory = MessageFactory<MMDSBeacon>;
+  friend factory;
+private:
 
   static const int HEAD_VERSION = 7;
   static const int COMPAT_VERSION = 6;
@@ -205,9 +211,6 @@ class MMDSBeacon : public PaxosServiceMessage {
   uint64_t mds_features;
 
  public:
-  typedef boost::intrusive_ptr<MMDSBeacon> ref;
-  typedef boost::intrusive_ptr<MMDSBeacon const> const_ref;
-
   MMDSBeacon()
     : PaxosServiceMessage(MSG_MDS_BEACON, 0, HEAD_VERSION, COMPAT_VERSION),
     global_id(0), state(MDSMap::STATE_NULL), standby_for_rank(MDS_RANK_NONE),
index c49c2ecebddca35e9dac46b9e0149a57b4274125..7d53829c2cd4efde32a555f90279c28797fcbe25 100644 (file)
 // sent from replica to auth
 
 class MMDSCacheRejoin : public Message {
+public:
+  typedef boost::intrusive_ptr<MMDSCacheRejoin> ref;
+  typedef boost::intrusive_ptr<MMDSCacheRejoin const> const_ref;
+  using factory = MessageFactory<MMDSCacheRejoin>;
+  friend factory;
+private:
 
   static const int HEAD_VERSION = 2;
   static const int COMPAT_VERSION = 1;
 
  public:
-  typedef boost::intrusive_ptr<MMDSCacheRejoin> ref;
-  typedef boost::intrusive_ptr<MMDSCacheRejoin const> const_ref;
-
   static const int OP_WEAK    = 1;  // replica -> auth, i exist, + maybe open files.
   static const int OP_STRONG  = 2;  // replica -> auth, i exist, + open files and lock state.
   static const int OP_ACK     = 3;  // auth -> replica, here is your lock state.
index 2d0cd8c6c6994dc6c75426ddaf1b1a691b40f79d..bfba7c5ef152c6561207456404b9c97114c95b5d 100644 (file)
@@ -22,6 +22,9 @@ class MMDSFindIno : public Message {
 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;
 
index 4680dd90d8a6b6cb441d3e717a0e1c9064f0d386..dc61ba8d06a750e00501beef2859bf14eb6a5100 100644 (file)
@@ -22,6 +22,9 @@ class MMDSFindInoReply : public Message {
 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;
 
index 650bba7d0eb51c61d2331cdb739ee16e51ccb71a..2618d9755f1c8a54c0d80cecc1bacb57fcd45616 100644 (file)
 #include "msg/Message.h"
 
 class MMDSFragmentNotify : public Message {
+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;
   frag_t basefrag;
   int8_t bits = 0;
 
  public:
-  typedef boost::intrusive_ptr<MMDSFragmentNotify> ref;
-  typedef boost::intrusive_ptr<MMDSFragmentNotify const> const_ref;
   inodeno_t get_ino() const { return ino; }
   frag_t get_basefrag() const { return basefrag; }
   int get_bits() const { return bits; }
index 6432ce791f046055f091d873dc3fc34fcdbbe148..687775263bfedf09093f24a17675782e309651ea 100644 (file)
 using std::map;
 
 class MMDSLoadTargets : public PaxosServiceMessage {
- public:
+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;
 
index 7f9f764d6922f11ee2d76d011fc0174303467b9c..03fb08791d457c1eaf84ae6d03431cff1b57166e 100644 (file)
 #include "include/ceph_features.h"
 
 class MMDSMap : public Message {
-  static const int HEAD_VERSION = 1;
-  static const int COMPAT_VERSION = 1;
 public:
   typedef boost::intrusive_ptr<MMDSMap> ref;
   typedef boost::intrusive_ptr<MMDSMap const> const_ref;
+  using factory = MessageFactory<MMDSMap>;
+  friend factory;
+private:
 
+  static const int HEAD_VERSION = 1;
+  static const int COMPAT_VERSION = 1;
+public:
   uuid_d fsid;
   epoch_t epoch = 0;
   bufferlist encoded;
index a7f775302bbe7315d88bf38d7f6a512bed71af90..6f62c136d36fa9999e3f71d6817d95156d432c0b 100644 (file)
 
 #include "msg/Message.h"
 
-struct MMDSOpenIno : public Message {
+class MMDSOpenIno : public Message {
 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;
 
index 555b9fd33c633b58f017a58120b89eb1cea786b1..77f1777e6cb556e0142691f81de29c304e82376a 100644 (file)
@@ -21,6 +21,8 @@ class MMDSOpenInoReply : public Message {
 public:
   typedef boost::intrusive_ptr<MMDSOpenInoReply> ref;
   typedef boost::intrusive_ptr<MMDSOpenInoReply const> const_ref;
+  using factory = MessageFactory<MMDSOpenInoReply>;
+  friend factory;
 
   inodeno_t ino;
   vector<inode_backpointer_t> ancestors;
index 65de1f313312eb0405c0391146da0daa510f5d3a..4316c981a0a13c6fbf501fb4b953f4d3880fc2c9 100644 (file)
@@ -23,6 +23,9 @@ class MMDSResolve : public Message {
 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;
   map<dirfrag_t, vector<dirfrag_t> > ambiguous_imports;
 
index 68cd164124da54c88c6ef106253585ee90198804..cdc0fd3c97f3748b038dd8818191423ec52dcfd9 100644 (file)
 
 
 class MMDSResolveAck : public Message {
- public:
+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;
 
index 2b688921e1cbee8dffb84bc6665d4ef5d9076c0c..a2b4c25e30994aef12e851cee91f2299839a1c40 100644 (file)
 #include "mds/mdstypes.h"
 
 class MMDSSlaveRequest : public Message {
- public:
+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;
   static const int OP_XLOCKACK =   -1;
   static const int OP_UNXLOCK =     2;
index 0c848ca03828162214f3a5e3453b4905d90237e0..ae36b314773b6565be9f297a70980f9e26f7187e 100644 (file)
 #include "msg/Message.h"
 
 class MMDSSnapUpdate : public Message {
+public:
+  typedef boost::intrusive_ptr<MMDSSnapUpdate> ref;
+  typedef boost::intrusive_ptr<MMDSSnapUpdate const> const_ref;
+  using factory = MessageFactory<MMDSSnapUpdate>;
+  friend factory;
+private:
+
   inodeno_t ino;
   __s16 snap_op;
 
 public:
-  typedef boost::intrusive_ptr<MMDSSnapUpdate> ref;
-  typedef boost::intrusive_ptr<MMDSSnapUpdate const> const_ref;
   inodeno_t get_ino() const { return ino; }
   int get_snap_op() const { return snap_op; }
 
index cac5d33f8223a60da6c2a615a3d3ab5e1421bc19..bc8165a8c42ed6bb383ef15958dda0d8c28ecab2 100644 (file)
 #include "mds/mds_table_types.h"
 
 class MMDSTableRequest : public Message {
- public:
+public:
   typedef boost::intrusive_ptr<MMDSTableRequest> ref;
   typedef boost::intrusive_ptr<MMDSTableRequest const> const_ref;
+  using factory = MessageFactory<MMDSTableRequest>;
+  friend factory;
 
   __u16 table = 0;
   __s16 op = 0;
index de76aaa70a3fc83197137c047d58f82f39560a46..91e7208a1d307472061e23744c050eccb93743db 100644 (file)
 
 
 class MMgrBeacon : public PaxosServiceMessage {
+public:
+  typedef boost::intrusive_ptr<MMgrBeacon> ref;
+  typedef boost::intrusive_ptr<MMgrBeacon const> const_ref;
+  using factory = MessageFactory<MMgrBeacon>;
+  friend factory;
+private:
 
   static const int HEAD_VERSION = 8;
   static const int COMPAT_VERSION = 8;
index 83946e7b43f4c5f97933f5f975b48867834c0220..d6b8415076b769715ba67b2953115e1123dc8f28 100644 (file)
@@ -7,6 +7,13 @@
 
 class MMgrClose : public Message
 {
+public:
+  typedef boost::intrusive_ptr<MMgrClose> ref;
+  typedef boost::intrusive_ptr<MMgrClose const> const_ref;
+  using factory = MessageFactory<MMgrClose>;
+  friend factory;
+private:
+
   static const int HEAD_VERSION = 1;
   static const int COMPAT_VERSION = 1;
 
index c65d2ba5500483b8f50474da0e3e7a5728734d12..c65d01229c5f0477f53cba079db1ac870d6c993d 100644 (file)
  */
 class MMgrConfigure : public Message
 {
+public:
+  typedef boost::intrusive_ptr<MMgrConfigure> ref;
+  typedef boost::intrusive_ptr<MMgrConfigure const> const_ref;
+  using factory = MessageFactory<MMgrConfigure>;
+  friend factory;
+private:
+
   static const int HEAD_VERSION = 2;
   static const int COMPAT_VERSION = 1;
 
index 31fff83fa09f24b5a76786015742b4613293c1ab..ad0863f36aa05becb8bb92755abf040ad88ab9e2 100644 (file)
  */
 class MMgrDigest : public Message {
 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;
 
index 1fbfdcca6a897e7eb42ed9f53e83890c450880ee..f15bba1bff0356c5696ffa85e0750794eac0cf07 100644 (file)
 #include "mon/MgrMap.h"
 
 class MMgrMap : public Message {
+public:
+  typedef boost::intrusive_ptr<MMgrMap> ref;
+  typedef boost::intrusive_ptr<MMgrMap const> const_ref;
+  using factory = MessageFactory<MMgrMap>;
+  friend factory;
+
 protected:
   MgrMap map;
 
index af60a91276110230bd15bb0b4dd3f6314333edf1..7db57a51d05778bab931d0ea70b7d18c8d8a5ee2 100644 (file)
 
 class MMgrOpen : public Message
 {
+public:
+  typedef boost::intrusive_ptr<MMgrOpen> ref;
+  typedef boost::intrusive_ptr<MMgrOpen const> const_ref;
+  using factory = MessageFactory<MMgrOpen>;
+  friend factory;
+private:
+
   static const int HEAD_VERSION = 3;
   static const int COMPAT_VERSION = 1;
 
index 86c9170249b30bc232aa411b476da2db3feeae80..fdc46410519e96b952e95aea3cbf4c1e91dcf37f 100644 (file)
@@ -72,6 +72,13 @@ WRITE_CLASS_ENCODER(PerfCounterType)
 
 class MMgrReport : public Message
 {
+public:
+  typedef boost::intrusive_ptr<MMgrReport> ref;
+  typedef boost::intrusive_ptr<MMgrReport const> const_ref;
+  using factory = MessageFactory<MMgrReport>;
+  friend factory;
+private:
+
   static const int HEAD_VERSION = 6;
   static const int COMPAT_VERSION = 1;
 
index c9a2e10b9e780263bee0525372cc1535d0e66b89..f609c4bc849bbded988e4d780f87ed9c31ca4eff 100644 (file)
 #include <string>
 
 class MMonCommand : public PaxosServiceMessage {
- public:
+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;
 
index b98f28fd89e94f1c9c4f9fba7c3041ae26b89ddd..4d2c442bca954a1ef5fbe1d0f0d89e7ed586106e 100644 (file)
 #include "messages/PaxosServiceMessage.h"
 
 class MMonCommandAck : public PaxosServiceMessage {
- public:
+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;
index c932e9ed68cccceac10090f7e51aa9d33be362c6..ad15fe998537c8d331545a9c6314dfce67e32c72 100644 (file)
 #include "mon/mon_types.h"
 
 class MMonElection : public Message {
+public:
+  typedef boost::intrusive_ptr<MMonElection> ref;
+  typedef boost::intrusive_ptr<MMonElection const> const_ref;
+  using factory = MessageFactory<MMonElection>;
+  friend factory;
 
+private:
   static const int HEAD_VERSION = 7;
   static const int COMPAT_VERSION = 5;
 
index 45682d1dd001dcc7ac86a449565ddafc0acb911f..eaae9d0b16a965a3e814b62e48e2e91beff8e22f 100644 (file)
 #include "include/types.h"
 
 class MMonGetMap : public Message {
- public:
+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) { }
 private:
   ~MMonGetMap() override {}
index 79546193969c8801ad697d65fa50ff2551ba0ae6..5579c250a7928bbee44ea906e4436dc5ee487e77 100644 (file)
 #include "include/types.h"
 
 class MMonGetOSDMap : public PaxosServiceMessage {
+public:
+  typedef boost::intrusive_ptr<MMonGetOSDMap> ref;
+  typedef boost::intrusive_ptr<MMonGetOSDMap const> const_ref;
+  using factory = MessageFactory<MMonGetOSDMap>;
+  friend factory;
+private:
+
   epoch_t full_first, full_last;
   epoch_t inc_first, inc_last;
 
index 39c197145d51a8f13c06f1b21292fa85ba813ab8..07faee88bf486d4c87b6c0d3420f48a7dd2d63d5 100644 (file)
  */
 class MMonGetVersion : public Message {
 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) {}
 
   const char *get_type_name() const override {
index b392fc186abcbaa40a6550c359e488a604ccf93d..2bc0fab78750593bba442d8a291b1a3ab5c11191 100644 (file)
  * back.
  */
 class MMonGetVersionReply : public Message {
-
+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:
index d7f126778b3957d550cbf246f8f18d37e54583c4..84db54bc4189a039f49ea085971006bd30cf7ff1 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-struct MMonGlobalID : public PaxosServiceMessage {
+class MMonGlobalID : public 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) { }
 private:
index b3b734b5b691055996153d402ecd023041c68178..0443dca292c756683112ffc271284f24cc2065f5 100644 (file)
 #include "messages/MMonQuorumService.h"
 #include "mon/mon_types.h"
 
-struct MMonHealth : public MMonQuorumService
-{
+class MMonHealth : public 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;
 
   int service_type = 0;
index c7d606d91bd4e7c16b6fea3e4248254f2d27bc02..30962f601d38c161db8f9cda0317c5af99c41bd8 100644 (file)
@@ -7,8 +7,13 @@
 #include "messages/PaxosServiceMessage.h"
 #include "mon/health_check.h"
 
-struct MMonHealthChecks : public PaxosServiceMessage
-{
+class MMonHealthChecks : public 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;
   static const int COMPAT_VERSION = 1;
 
index 76bf487707efad99f306d0faf71ffa1a4b67baf5..597b1039f4c71872866f39be3d1c9acefc148cf5 100644 (file)
 using std::vector;
 
 class MMonJoin : public PaxosServiceMessage {
- public:
+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;
index e44e1eb936e87f77475c6dc59db8860accb80258..8cd9c5d3f29211b94fe60d0c29e44c99b8d5863c 100644 (file)
 
 class MMonMap : public Message {
 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) { }
index 9caad8661c60a896f75f17311d93de543da1f0ea..1e50e43cd4285a69bb8c4bbbf3480503611ddcf6 100644 (file)
 
 class MMonMetadata : public Message {
 public:
+  typedef boost::intrusive_ptr<MMonMetadata> ref;
+  typedef boost::intrusive_ptr<MMonMetadata const> const_ref;
+  using factory = MessageFactory<MMonMetadata>;
+  friend factory;
+
   Metadata data;
 
 private:
index 72ae62270779dfef5ed6d4cb055d304cbb59c045..81464ff61b3377d08ea3fd353902d365e26f1dad 100644 (file)
 #include "mon/health_check.h"
 
 class MMonMgrReport : public 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;
   static const int COMPAT_VERSION = 1;
 
index ff0a6ee5975f8b96ca7ff3a4cb1ebdda26401942..a872f7ac366b56f39576773df1e8f4808f5c2bec 100644 (file)
 #include "include/ceph_features.h"
 
 class MMonPaxos : public Message {
-
+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;
   static const int COMPAT_VERSION = 3;
 
index b5380d788344e36fbbf2f9e422de65bac36bfd38..6709a26031a2895537f56c7f932464ef0f05646e 100644 (file)
 
 class MMonProbe : public Message {
 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;
   static const int COMPAT_VERSION = 5;
 
index 4b82f83b3350247cfcdeb0cd44951f834db55fa1..be09e54b833163a81b031ebbf92edf5202628334 100644 (file)
 
 #include "msg/Message.h"
 
-struct MMonQuorumService : public Message
-{
+class MMonQuorumService : public Message {
+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;
 
index 345fbabf17edc1a3f4f082c030fad0f7a64177a0..5a7936965a81d1fe43af53516c4c4fdc41e235d6 100644 (file)
 #include "msg/Message.h"
 #include "mon/mon_types.h"
 
-class MMonScrub : public Message
-{
+class MMonScrub : public Message {
+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;
   static const int COMPAT_VERSION = 2;
 
index 6ccfe46e21e5901040e4a787117f5011b8bc309a..32dc5429ceac836eac970a402ef8764f003ac9b0 100644 (file)
@@ -29,7 +29,12 @@ struct ceph_mon_subscribe_item_old {
 WRITE_RAW_ENCODER(ceph_mon_subscribe_item_old)
 
 
-struct MMonSubscribe : public Message {
+class MMonSubscribe : public Message {
+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;
   static const int COMPAT_VERSION = 1;
index 3753ee2977060f8402fb46eb6687316bf73a328e..35681cb932a1558fc0e257842910b83ba241e4f0 100644 (file)
 
 #include "msg/Message.h"
 
-struct MMonSubscribeAck : public Message {
+class MMonSubscribeAck : public Message {
+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;
   
index 5b9c9e2c4d189d571763f706480523fb2e269f80..8e5ae95a2f4efbfc0feea24d6d2c995b16328ce3 100644 (file)
 
 #include "msg/Message.h"
 
-class MMonSync : public Message
-{
+class MMonSync : public Message {
+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;
   static const int COMPAT_VERSION = 2;
 
index 61fd5c6edb6b8d0bdedcb61dde5c090a35e34f3a..f59816d0b67d73dfce967e86468cb898bba9b136 100644 (file)
  */
 class MNop : public Message {
 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;
   static const int COMPAT_VERSION = 1;
 
index 5d84b8cd528b2bd08a8ade50386e44ce4ddfd99b..5e868add1400bd57ee1c1c1f4f37ef613f908648 100644 (file)
 #include "messages/PaxosServiceMessage.h"
 
 class MOSDAlive : public PaxosServiceMessage {
- public:
+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) { }
index a24da39146365541f8bc71abe9074baf1d289904..1b2e511629b1264051fb3918c8aa87c59c03aee9 100644 (file)
 
 class MOSDBackoff : public 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;
   static constexpr int COMPAT_VERSION = 1;
 
index 5c9e6762b65f634649af9fcc8a92a4b1e5e30bdd..ff79842867b26eb5340255c33dc3718199e72c24 100644 (file)
@@ -5,6 +5,11 @@
 
 class MOSDBeacon : public 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;
 
index beb6a587f20348d76a95a61ff25c9b325fdeeda1..475d889cc0e90ed703fbd5cba8431a710a4c2106 100644 (file)
 #include "osd/osd_types.h"
 
 class MOSDBoot : public 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;
   static const int COMPAT_VERSION = 6;
 
index bfb038087bf9f4d005cfd61c40e147bdcd94700c..62215378179f4cf716c4bf2f860e91f2297d2841 100644 (file)
 #include "osd/ECMsgTypes.h"
 
 class MOSDECSubOpRead : public 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;
   static const int COMPAT_VERSION = 1;
 
index e78f324e35945b520444da23ddbf30a7d278540c..6dc46a89219cc20b4ede12b04799b99260e75031 100644 (file)
 #include "osd/ECMsgTypes.h"
 
 class MOSDECSubOpReadReply : public 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;
   static const int COMPAT_VERSION = 1;
 
index 923c45ff1246dbf01c151d8f172c2b82d39a9b58..7fc55b62b6eaa10908ac4bd0a76094482d18731b 100644 (file)
 #include "osd/ECMsgTypes.h"
 
 class MOSDECSubOpWrite : public 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;
   static const int COMPAT_VERSION = 1;
 
index 76d4fca4df9ddec283c15af650db5feb5adbbd67..e07dca836cee17d209c30d656c77f49054d4f9b5 100644 (file)
 #include "osd/ECMsgTypes.h"
 
 class MOSDECSubOpWriteReply : public 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;
   static const int COMPAT_VERSION = 1;
 
index 244252d9476007c9d633d024dadd361487573a00..37d70af341c6739c3aca966a75396431b92285c7 100644 (file)
 
 
 class MOSDFailure : public 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;
   static const int COMPAT_VERSION = 4;
 
index 1eaa2c37f9a3b546eb7ad649e0aa7fae2f0b0aad..3ba555f89292bc659657f14b7b8a8f6884ab6a5e 100644 (file)
@@ -9,6 +9,11 @@
 
 class MOSDFastDispatchOp : public Message {
 public:
+  typedef boost::intrusive_ptr<MOSDFastDispatchOp> ref;
+  typedef boost::intrusive_ptr<MOSDFastDispatchOp const> const_ref;
+  using factory = MessageFactory<MOSDFastDispatchOp>;
+  friend factory;
+
   virtual epoch_t get_map_epoch() const = 0;
   virtual epoch_t get_min_epoch() const {
     return get_map_epoch();
index 684d2a5875a2b24f19a0595af1527fd7da0e5564..06e47ea3ce4ab45f67905ae60eeda4b8654d1e50 100644 (file)
@@ -31,7 +31,12 @@ static const int OFR_BACKFILL = 2;
 // cancel priority boost, requeue if necessary
 static const int OFR_CANCEL = 4;
 
-struct MOSDForceRecovery : public Message {
+class MOSDForceRecovery : public Message {
+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;
   static const int COMPAT_VERSION = 2;
index f84a976d602c42d4b81204237a2a2257f4daaa8d..6573aa3101caf116c096270ad8a33cf0e6124faa 100644 (file)
 // for now name it for its sole application.
 
 class MOSDFull : public PaxosServiceMessage {
- public:
+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;
   uint32_t state = 0;
 
index fc07660c9c264db7c893020e32bd6c2c58bb96e0..f0149650b2871fb740963ec252ab092e95faf1ec 100644 (file)
 #include "include/ceph_features.h"
 
 class MOSDMap : public Message {
-
+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;
   static const int COMPAT_VERSION = 3;
 
index 66e29063a87fd49539fe308fd417a5a78527924c..faa360760b0958eb139c48cd07f8c23a388fc1ca 100644 (file)
 #include "messages/PaxosServiceMessage.h"
 
 class MOSDMarkMeDown : public 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;
   static const int COMPAT_VERSION = 3;
 
index a1ec292c4173101f9dd8d8cd2cea1ad58217ca00..30e11ceee69bfbc8436a07b440215d4da8b7c1a3 100644 (file)
 class OSD;
 
 class MOSDOp : public 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;
   static const int COMPAT_VERSION = 3;
 
index d6f38d8f47db4280bf4160af0588432b79ec3118..b4dc9d8595f8f9705ba898ffb0666b24ae5b4ab9 100644 (file)
  */
 
 class MOSDOpReply : public Message {
-
+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;
   static const int COMPAT_VERSION = 2;
 
index 108d72caf55578cd9f959c5a1580e6d5b7b73ebf..849a0bc7f1f08fd6b13b4ebd4a7ae243874fbbdc 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGBackfill : public 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;
   static const int COMPAT_VERSION = 3;
 public:
index 49e9db59006719a7a06249dd9acc818647ebc4f4..0c10e9409dca98565b17b2c63e0ab09b0d18aa8c 100644 (file)
  * instruct non-primary to remove some objects during backfill
  */
 
-struct MOSDPGBackfillRemove : public MOSDFastDispatchOp {
+class MOSDPGBackfillRemove : public 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;
   static const int COMPAT_VERSION = 1;
index 9e69b0637e5391ecc61b958200821c4ffe422354..7384c4f499ed1a1ce340b2a064d2c5ef58c9737e 100644 (file)
  * PGCreate - instruct an OSD to create a pg, if it doesn't already exist
  */
 
-struct MOSDPGCreate : public Message {
+class MOSDPGCreate : public Message {
+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;
   const static int COMPAT_VERSION = 3;
index 867a5775f5e30e229553a923fde7e4343a7d2102..6b2694b7d11eda6157303ee47e04e526a7886977 100644 (file)
  * PGCreate2 - instruct an OSD to create some pgs
  */
 
-struct MOSDPGCreate2 : public Message {
+class MOSDPGCreate2 : public Message {
+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;
   const static int COMPAT_VERSION = 1;
 
index 30110cd5baf612970cfd99568c03d8425f9f1eae..50ad405efe8a8f47b20a24239b1ab5da44f7e07d 100644 (file)
@@ -8,6 +8,11 @@
 
 class MOSDPGCreated : public 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)
index 860a5a474424314c883806621e8f3b0f7a84c6f8..48980ce1941c0ded3d35e48f74f0d46cf4264ce9 100644 (file)
 #include "osd/osd_types.h"
 
 class MOSDPGInfo : public Message {
+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;
   static const int COMPAT_VERSION = 5;
 
index 2ae27f3a5890dfc900a10fe7e810e42d962fafec..9813db344c945fe5598fbaa62db09729d77c2911 100644 (file)
 #include "messages/MOSDPeeringOp.h"
 
 class MOSDPGLog : public 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;
   static const int COMPAT_VERSION = 5;
 
index 936829b1f7797bd045b4115acb3878263f12a7ec..b5235ff9e2e306fd1754bf6ec93f46bb45b660e4 100644 (file)
  */
 
 class MOSDPGNotify : public Message {
-
+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;
   static const int COMPAT_VERSION = 6;
 
index 82bf8c6eb9d7c1868ca7f5a5f5be9a5ffb39304e..3e3d91321f261c813e1e65fa1549a95f070ecb38 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGPull : public 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;
   static const int COMPAT_VERSION = 2;
 
index f4a751364819cba1f007c2f013a5156b314da570..1a27bc391598020517fa4fe71d71c529e590213d 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGPush : public 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;
   static const int COMPAT_VERSION = 2;
 
index a56783c4baf7f0064acfd18cffe92da2db9e0ef7..8b718c622820b4e1f19744b17fd3447929975e9f 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGPushReply : public 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;
   static const int COMPAT_VERSION = 2;
 
index 13e5610f833f652d58aad0547ae716f6ad11ba1a..70768a1c72b98a3e6835c214a6530be6de54ce44 100644 (file)
  */
 
 class MOSDPGQuery : public Message {
+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;
   static const int COMPAT_VERSION = 4;
 
index 85bd464cdf101a6b02fcbc948f71ec25a1c521d8..3730cd339941cffdd3a8e904b0198edfdc56f161 100644 (file)
  * instruct non-primary to remove some objects during recovery
  */
 
-struct MOSDPGRecoveryDelete : public MOSDFastDispatchOp {
+class MOSDPGRecoveryDelete : public 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;
   static const int COMPAT_VERSION = 1;
index eb9624866eafce18df10e4ac20a0f6ca96449e03..ca414bb7282474b8c5422f904a2c03e47c5067dd 100644 (file)
@@ -6,7 +6,13 @@
 
 #include "MOSDFastDispatchOp.h"
 
-struct MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp {
+class MOSDPGRecoveryDeleteReply : public 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;
   static const int COMPAT_VERSION = 1;
 
index 979dd27c47b06b2ad7a31a8403dc3b3af666a743..278f184b8b5364abd5c9be6abc8b9bc11225aa6c 100644 (file)
 
 
 class MOSDPGRemove : public Message {
-
+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;
   static const int COMPAT_VERSION = 3;
 
index d921d27ea6c202500966a37f98a78b54a7e8afd1..50d0a140864bfc487ab9e41b87ff50e2471f7689 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGScan : public 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;
   static const int COMPAT_VERSION = 2;
 
index 80f465e5b62f76030122b416376b0b319ec62a23..c06f8d0231da77e0fe275b2c642faaf18cb82f06 100644 (file)
 #include "messages/PaxosServiceMessage.h"
 
 class MOSDPGTemp : public PaxosServiceMessage {
- public:
+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;
   map<pg_t, vector<int32_t> > pg_temp;
   bool forced = false;
index ad03c1e57281f3c80cbc3949fcad9779b4d35ecd..106443798d61c5e790c1543b022902f049c16b49 100644 (file)
 #include "messages/MOSDPeeringOp.h"
 
 class MOSDPGTrim : public 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;
   static const int COMPAT_VERSION = 2;
 
index 871ec98607da550ea1ed1bdd581f4344dee868d4..91923cff9dcf97d26609457a42cee1a36dcb90d3 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGUpdateLogMissing : public 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;
   static const int COMPAT_VERSION = 1;
 
index 5c139137b4ae0d22770a2ec4a202bd3727344966..a6bdef7a65a8226d7791066d074d43d6b89ec76c 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDPGUpdateLogMissingReply : public 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;
   static const int COMPAT_VERSION = 1;
 
index 338d4214164efb727dc6410635861b14e9f3abec..f1c2a60db55ff496453b9db0ea8553d3baa87b5c 100644 (file)
@@ -9,6 +9,11 @@
 
 class MOSDPeeringOp : public Message {
 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) {}
 
index 93670beaaa7f054781f7a521ce4223ab9f76e038..3fd98fe40ee930e1e6b67268eb1e81f00333133a 100644 (file)
 
 
 class MOSDPing : public Message {
-
+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;
   static const int COMPAT_VERSION = 4;
 
index 70ba7a5b479eed0708668f05324231d82a9ee4d9..6c26aadf302346275dae74d891dc43b65c28279b 100644 (file)
  */
 
 class MOSDRepOp : public 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;
   static const int COMPAT_VERSION = 1;
 
index 13fedb174fed1dd76d6b9a81fa51139b13f6db2a..d8eea1471953973dbdd2678d448be8c408a10c53 100644 (file)
  */
 
 class MOSDRepOpReply : public 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;
   static const int COMPAT_VERSION = 1;
 public:
index 877f0185ed0ad2cf6803855cc1f1555c133d1ace..1610fd1086629c9441e12310ad6bcc121c1c6433 100644 (file)
  * instruct an OSD initiate a replica scrub on a specific PG
  */
 
-struct MOSDRepScrub : public MOSDFastDispatchOp {
+class MOSDRepScrub : public 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;
   static const int COMPAT_VERSION = 6;
index 522f01e38915f0354bab71266cc32c4c168f1f5d..b32717808ed42d41bbe57499d5e169631207aa0c 100644 (file)
  * pass a ScrubMap from a shard back to the primary
  */
 
-struct MOSDRepScrubMap : public MOSDFastDispatchOp {
+class MOSDRepScrubMap : public 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;
   static const int COMPAT_VERSION = 1;
index bee348f3903ab887636302f43efb76da3cd873ff..a487dd1700e77cdb5c3288a2a344fe70eaabe088 100644 (file)
  * instruct an OSD to scrub some or all pg(s)
  */
 
-struct MOSDScrub : public Message {
+class MOSDScrub : public Message {
+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;
   static const int COMPAT_VERSION = 2;
index 20b54a83baaec2e093dec391f43943c61f2e62b4..96ec1ae622d50e340f35577f0b28ff883252dc4c 100644 (file)
@@ -9,7 +9,12 @@
  * instruct an OSD to scrub some or all pg(s)
  */
 
-struct MOSDScrub2 : public Message {
+class MOSDScrub2 : public Message {
+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;
   static const int COMPAT_VERSION = 1;
index 8293141333a678899c2a29fff715018ffe9cca7b..94d7164307523ef952b1bdfffc8888af3fe72f0d 100644 (file)
 #include "MOSDFastDispatchOp.h"
 
 class MOSDScrubReserve : public 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;
   static const int COMPAT_VERSION = 1;
 public:
index 723d764c263d5699a907e0473aeccc9a60b1ab23..7c49156db38542571e20b80f22273ad6a8eae5b6 100644 (file)
 
 class MPGStats : public 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;
   map<pg_t,pg_stat_t> pg_stat;
   osd_stat_t osd_stat;
index d7336c307434cdad492d4b6653bddcea3615c648..2080e31109f1891d6081d35f3ffb115317ead198 100644 (file)
 
 class MPGStatsAck : public Message {
 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) {}
index ce11edaf76964348911211f7d01f3ce30555a7ef..88fedb29a185ed6fca8f751717844c212e10f947 100644 (file)
 #include "msg/Message.h"
 
 class MPing : public Message {
- public:
+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) {}
 private:
   ~MPing() override {}
index 508218de665b2b880d31c498666748a11ebb81ca..8ad344ef559d8ef13cf19ce93ed6cb7604d41d0a 100644 (file)
 
 
 class MPoolOp : public 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;
   static const int COMPAT_VERSION = 2;
 
index c5fe917627a535d97896818baeb08ab58caa2c7f..13b13684cabdc5aaac9a630b5cc9274420914312 100644 (file)
 
 class MPoolOpReply : public 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;
   __u32 replyCode = 0;
   epoch_t epoch = 0;
index 9803094357b7b0d092156eb0114d407099fe19b9..a0eb2a5e33d1552833c83794f81e2b7a25449b70 100644 (file)
 #include "messages/MOSDPeeringOp.h"
 
 class MRecoveryReserve : public 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;
   static const int COMPAT_VERSION = 2;
 public:
index 8ecc8d940ddfd9094c9d1c91365a064a371f495c..332b5c9f48e3de8bc48d6c0ddb9a93add03bdb27 100644 (file)
 
 #include "messages/PaxosServiceMessage.h"
 
-struct MRemoveSnaps : public PaxosServiceMessage {
+class MRemoveSnaps : public 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;
   
   MRemoveSnaps() : 
index 7df923e13b8fb7bd19652a0763e2b2ec7895cd44..74228cfbb66e3c4db144e44931d724c29b668813 100644 (file)
 #include "msg/Message.h"
 #include "include/encoding.h"
 
-struct MRoute : public Message {
+class MRoute : public Message {
+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;
   static const int COMPAT_VERSION = 3;
index b1022b4a3c39d2a187c8f54964f1f75e69d34a11..084044c3862f4f0eedadb9620319158c4aee53ea 100644 (file)
@@ -8,6 +8,11 @@
 
 class MServiceMap : public Message {
 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) { }
index edb9a11d7ab1291262a0bc87f0af2a8639e19251..392c931242b965c9bdde4699c6d4969b4f77322a 100644 (file)
 #include "messages/PaxosServiceMessage.h"
 
 class MStatfs : public 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;
   static const int COMPAT_VERSION = 1;
 
index a5b3ac0a4b051d07a3ef0495c23e6aebbc2961d0..b925b31afdfa29e5f23d99713b6d4334bed123c1 100644 (file)
 
 class MStatfsReply : public Message {
 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) {}
index 911aba0d9b5d73ee7f09239d19583f656230e347..b8a7b75e145a8572973bbf0254fe2f57bc4709ce 100644 (file)
 #ifndef CEPH_MTIMECHECK_H
 #define CEPH_MTIMECHECK_H
 
-struct MTimeCheck : public Message
-{
+class MTimeCheck : public Message {
+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;
 
   enum {
index ea4f66ec8878ad1def15d066c250b03d8a4568d3..bda6aef9cb938083ad29c7a49ef2cccfd929e6b1 100644 (file)
 
 #pragma once
 
-struct MTimeCheck2 : public Message
-{
+class MTimeCheck2 : public Message {
+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;
   static const int COMPAT_VERSION = 1;
 
index cd01177a5f0441d32bf75ba864d27bbee35a6018..e0ace85c50e3ec4190dda981b049b68806a1ebf9 100644 (file)
 
 
 class MWatchNotify : public Message {
+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;
   static const int COMPAT_VERSION = 1;
 
index a13dc938e8a3ea830da170015a3e11bba296bdbf..d902e445e525c084859e8752bd590b80d602265f 100644 (file)
@@ -5,7 +5,12 @@
 #include "mon/Session.h"
 
 class PaxosServiceMessage : public Message {
- public:
+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;
index a360089d209985f56fec7fa1e9b665184b3448c8..60c93aaa5367c873b6cd66f4f77b479b5f7d6e11 100644 (file)
@@ -328,509 +328,509 @@ Message *decode_message(CephContext *cct, int crcflags,
   }
 
   // make message
-  Message *m = 0;
+  Message::ref m;
   int type = header.type;
   switch (type) {
 
     // -- with payload --
 
   case MSG_PGSTATS:
-    m = new MPGStats;
+    m = MPGStats::factory::build();
     break;
   case MSG_PGSTATSACK:
-    m = new MPGStatsAck;
+    m = MPGStatsAck::factory::build();
     break;
 
   case CEPH_MSG_STATFS:
-    m = new MStatfs;
+    m = MStatfs::factory::build();
     break;
   case CEPH_MSG_STATFS_REPLY:
-    m = new MStatfsReply;
+    m = MStatfsReply::factory::build();
     break;
   case MSG_GETPOOLSTATS:
-    m = new MGetPoolStats;
+    m = MGetPoolStats::factory::build();
     break;
   case MSG_GETPOOLSTATSREPLY:
-    m = new MGetPoolStatsReply;
+    m = MGetPoolStatsReply::factory::build();
     break;
   case CEPH_MSG_POOLOP:
-    m = new MPoolOp;
+    m = MPoolOp::factory::build();
     break;
   case CEPH_MSG_POOLOP_REPLY:
-    m = new MPoolOpReply;
+    m = MPoolOpReply::factory::build();
     break;
   case MSG_MON_COMMAND:
-    m = new MMonCommand;
+    m = MMonCommand::factory::build();
     break;
   case MSG_MON_COMMAND_ACK:
-    m = new MMonCommandAck;
+    m = MMonCommandAck::factory::build();
     break;
   case MSG_MON_PAXOS:
-    m = new MMonPaxos;
+    m = MMonPaxos::factory::build();
     break;
   case MSG_CONFIG:
-    m = new MConfig;
+    m = MConfig::factory::build();
     break;
   case MSG_GET_CONFIG:
-    m = new MGetConfig;
+    m = MGetConfig::factory::build();
     break;
 
   case MSG_MON_PROBE:
-    m = new MMonProbe;
+    m = MMonProbe::factory::build();
     break;
   case MSG_MON_JOIN:
-    m = new MMonJoin;
+    m = MMonJoin::factory::build();
     break;
   case MSG_MON_ELECTION:
-    m = new MMonElection;
+    m = MMonElection::factory::build();
     break;
   case MSG_MON_SYNC:
-    m = new MMonSync;
+    m = MMonSync::factory::build();
     break;
   case MSG_MON_SCRUB:
-    m = new MMonScrub;
+    m = MMonScrub::factory::build();
     break;
 
   case MSG_LOG:
-    m = new MLog;
+    m = MLog::factory::build();
     break;
   case MSG_LOGACK:
-    m = new MLogAck;
+    m = MLogAck::factory::build();
     break;
 
   case CEPH_MSG_PING:
-    m = new MPing();
+    m = MPing::factory::build();
     break;
   case MSG_COMMAND:
-    m = new MCommand;
+    m = MCommand::factory::build();
     break;
   case MSG_COMMAND_REPLY:
-    m = new MCommandReply;
+    m = MCommandReply::factory::build();
     break;
   case MSG_OSD_BACKFILL_RESERVE:
-    m = new MBackfillReserve;
+    m = MBackfillReserve::factory::build();
     break;
   case MSG_OSD_RECOVERY_RESERVE:
-    m = new MRecoveryReserve;
+    m = MRecoveryReserve::factory::build();
     break;
   case MSG_OSD_FORCE_RECOVERY:
-    m = new MOSDForceRecovery;
+    m = MOSDForceRecovery::factory::build();
     break;
 
   case MSG_ROUTE:
-    m = new MRoute;
+    m = MRoute::factory::build();
     break;
   case MSG_FORWARD:
-    m = new MForward;
+    m = MForward::factory::build();
     break;
     
   case CEPH_MSG_MON_MAP:
-    m = new MMonMap;
+    m = MMonMap::factory::build();
     break;
   case CEPH_MSG_MON_GET_MAP:
-    m = new MMonGetMap;
+    m = MMonGetMap::factory::build();
     break;
   case CEPH_MSG_MON_GET_OSDMAP:
-    m = new MMonGetOSDMap;
+    m = MMonGetOSDMap::factory::build();
     break;
   case CEPH_MSG_MON_GET_VERSION:
-    m = new MMonGetVersion();
+    m = MMonGetVersion::factory::build();
     break;
   case CEPH_MSG_MON_GET_VERSION_REPLY:
-    m = new MMonGetVersionReply();
+    m = MMonGetVersionReply::factory::build();
     break;
   case CEPH_MSG_MON_METADATA:
-    m = new MMonMetadata();
+    m = MMonMetadata::factory::build();
     break;
 
   case MSG_OSD_BOOT:
-    m = new MOSDBoot();
+    m = MOSDBoot::factory::build();
     break;
   case MSG_OSD_ALIVE:
-    m = new MOSDAlive();
+    m = MOSDAlive::factory::build();
     break;
   case MSG_OSD_BEACON:
-    m = new MOSDBeacon();
+    m = MOSDBeacon::factory::build();
     break;
   case MSG_OSD_PGTEMP:
-    m = new MOSDPGTemp;
+    m = MOSDPGTemp::factory::build();
     break;
   case MSG_OSD_FAILURE:
-    m = new MOSDFailure();
+    m = MOSDFailure::factory::build();
     break;
   case MSG_OSD_MARK_ME_DOWN:
-    m = new MOSDMarkMeDown();
+    m = MOSDMarkMeDown::factory::build();
     break;
   case MSG_OSD_FULL:
-    m = new MOSDFull();
+    m = MOSDFull::factory::build();
     break;
   case MSG_OSD_PING:
-    m = new MOSDPing();
+    m = MOSDPing::factory::build();
     break;
   case CEPH_MSG_OSD_OP:
-    m = new MOSDOp();
+    m = MOSDOp::factory::build();
     break;
   case CEPH_MSG_OSD_OPREPLY:
-    m = new MOSDOpReply();
+    m = MOSDOpReply::factory::build();
     break;
   case MSG_OSD_REPOP:
-    m = new MOSDRepOp();
+    m = MOSDRepOp::factory::build();
     break;
   case MSG_OSD_REPOPREPLY:
-    m = new MOSDRepOpReply();
+    m = MOSDRepOpReply::factory::build();
     break;
   case MSG_OSD_PG_CREATED:
-    m = new MOSDPGCreated();
+    m = MOSDPGCreated::factory::build();
     break;
   case MSG_OSD_PG_UPDATE_LOG_MISSING:
-    m = new MOSDPGUpdateLogMissing();
+    m = MOSDPGUpdateLogMissing::factory::build();
     break;
   case MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY:
-    m = new MOSDPGUpdateLogMissingReply();
+    m = MOSDPGUpdateLogMissingReply::factory::build();
     break;
   case CEPH_MSG_OSD_BACKOFF:
-    m = new MOSDBackoff;
+    m = MOSDBackoff::factory::build();
     break;
 
   case CEPH_MSG_OSD_MAP:
-    m = new MOSDMap;
+    m = MOSDMap::factory::build();
     break;
 
   case CEPH_MSG_WATCH_NOTIFY:
-    m = new MWatchNotify;
+    m = MWatchNotify::factory::build();
     break;
 
   case MSG_OSD_PG_NOTIFY:
-    m = new MOSDPGNotify;
+    m = MOSDPGNotify::factory::build();
     break;
   case MSG_OSD_PG_QUERY:
-    m = new MOSDPGQuery;
+    m = MOSDPGQuery::factory::build();
     break;
   case MSG_OSD_PG_LOG:
-    m = new MOSDPGLog;
+    m = MOSDPGLog::factory::build();
     break;
   case MSG_OSD_PG_REMOVE:
-    m = new MOSDPGRemove;
+    m = MOSDPGRemove::factory::build();
     break;
   case MSG_OSD_PG_INFO:
-    m = new MOSDPGInfo;
+    m = MOSDPGInfo::factory::build();
     break;
   case MSG_OSD_PG_CREATE:
-    m = new MOSDPGCreate;
+    m = MOSDPGCreate::factory::build();
     break;
   case MSG_OSD_PG_CREATE2:
-    m = new MOSDPGCreate2;
+    m = MOSDPGCreate2::factory::build();
     break;
   case MSG_OSD_PG_TRIM:
-    m = new MOSDPGTrim;
+    m = MOSDPGTrim::factory::build();
     break;
 
   case MSG_OSD_SCRUB:
-    m = new MOSDScrub;
+    m = MOSDScrub::factory::build();
     break;
   case MSG_OSD_SCRUB2:
-    m = new MOSDScrub2;
+    m = MOSDScrub2::factory::build();
     break;
   case MSG_OSD_SCRUB_RESERVE:
-    m = new MOSDScrubReserve;
+    m = MOSDScrubReserve::factory::build();
     break;
   case MSG_REMOVE_SNAPS:
-    m = new MRemoveSnaps;
+    m = MRemoveSnaps::factory::build();
     break;
   case MSG_OSD_REP_SCRUB:
-    m = new MOSDRepScrub;
+    m = MOSDRepScrub::factory::build();
     break;
   case MSG_OSD_REP_SCRUBMAP:
-    m = new MOSDRepScrubMap;
+    m = MOSDRepScrubMap::factory::build();
     break;
   case MSG_OSD_PG_SCAN:
-    m = new MOSDPGScan;
+    m = MOSDPGScan::factory::build();
     break;
   case MSG_OSD_PG_BACKFILL:
-    m = new MOSDPGBackfill;
+    m = MOSDPGBackfill::factory::build();
     break;
   case MSG_OSD_PG_BACKFILL_REMOVE:
-    m = new MOSDPGBackfillRemove;
+    m = MOSDPGBackfillRemove::factory::build();
     break;
   case MSG_OSD_PG_PUSH:
-    m = new MOSDPGPush;
+    m = MOSDPGPush::factory::build();
     break;
   case MSG_OSD_PG_PULL:
-    m = new MOSDPGPull;
+    m = MOSDPGPull::factory::build();
     break;
   case MSG_OSD_PG_PUSH_REPLY:
-    m = new MOSDPGPushReply;
+    m = MOSDPGPushReply::factory::build();
     break;
   case MSG_OSD_PG_RECOVERY_DELETE:
-    m = new MOSDPGRecoveryDelete;
+    m = MOSDPGRecoveryDelete::factory::build();
     break;
   case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
-    m = new MOSDPGRecoveryDeleteReply;
+    m = MOSDPGRecoveryDeleteReply::factory::build();
     break;
   case MSG_OSD_EC_WRITE:
-    m = new MOSDECSubOpWrite;
+    m = MOSDECSubOpWrite::factory::build();
     break;
   case MSG_OSD_EC_WRITE_REPLY:
-    m = new MOSDECSubOpWriteReply;
+    m = MOSDECSubOpWriteReply::factory::build();
     break;
   case MSG_OSD_EC_READ:
-    m = new MOSDECSubOpRead;
+    m = MOSDECSubOpRead::factory::build();
     break;
   case MSG_OSD_EC_READ_REPLY:
-    m = new MOSDECSubOpReadReply;
+    m = MOSDECSubOpReadReply::factory::build();
     break;
    // auth
   case CEPH_MSG_AUTH:
-    m = new MAuth;
+    m = MAuth::factory::build();
     break;
   case CEPH_MSG_AUTH_REPLY:
-    m = new MAuthReply;
+    m = MAuthReply::factory::build();
     break;
 
   case MSG_MON_GLOBAL_ID:
-    m = new MMonGlobalID;
+    m = MMonGlobalID::factory::build();
     break; 
 
     // clients
   case CEPH_MSG_MON_SUBSCRIBE:
-    m = new MMonSubscribe;
+    m = MMonSubscribe::factory::build();
     break;
   case CEPH_MSG_MON_SUBSCRIBE_ACK:
-    m = new MMonSubscribeAck;
+    m = MMonSubscribeAck::factory::build();
     break;
   case CEPH_MSG_CLIENT_SESSION:
-    m = new MClientSession;
+    m = MClientSession::factory::build();
     break;
   case CEPH_MSG_CLIENT_RECONNECT:
-    m = new MClientReconnect;
+    m = MClientReconnect::factory::build();
     break;
   case CEPH_MSG_CLIENT_REQUEST:
-    m = new MClientRequest;
+    m = MClientRequest::factory::build();
     break;
   case CEPH_MSG_CLIENT_REQUEST_FORWARD:
-    m = new MClientRequestForward;
+    m = MClientRequestForward::factory::build();
     break;
   case CEPH_MSG_CLIENT_REPLY:
-    m = new MClientReply;
+    m = MClientReply::factory::build();
     break;
   case CEPH_MSG_CLIENT_CAPS:
-    m = new MClientCaps;
+    m = MClientCaps::factory::build();
     break;
   case CEPH_MSG_CLIENT_CAPRELEASE:
-    m = new MClientCapRelease;
+    m = MClientCapRelease::factory::build();
     break;
   case CEPH_MSG_CLIENT_LEASE:
-    m = new MClientLease;
+    m = MClientLease::factory::build();
     break;
   case CEPH_MSG_CLIENT_SNAP:
-    m = new MClientSnap;
+    m = MClientSnap::factory::build();
     break;
   case CEPH_MSG_CLIENT_QUOTA:
-    m = new MClientQuota;
+    m = MClientQuota::factory::build();
     break;
 
     // mds
   case MSG_MDS_SLAVE_REQUEST:
-    m = new MMDSSlaveRequest;
+    m = MMDSSlaveRequest::factory::build();
     break;
 
   case CEPH_MSG_MDS_MAP:
-    m = new MMDSMap;
+    m = MMDSMap::factory::build();
     break;
   case CEPH_MSG_FS_MAP:
-    m = new MFSMap;
+    m = MFSMap::factory::build();
     break;
   case CEPH_MSG_FS_MAP_USER:
-    m = new MFSMapUser;
+    m = MFSMapUser::factory::build();
     break;
   case MSG_MDS_BEACON:
-    m = new MMDSBeacon;
+    m = MMDSBeacon::factory::build();
     break;
   case MSG_MDS_OFFLOAD_TARGETS:
-    m = new MMDSLoadTargets;
+    m = MMDSLoadTargets::factory::build();
     break;
   case MSG_MDS_RESOLVE:
-    m = new MMDSResolve;
+    m = MMDSResolve::factory::build();
     break;
   case MSG_MDS_RESOLVEACK:
-    m = new MMDSResolveAck;
+    m = MMDSResolveAck::factory::build();
     break;
   case MSG_MDS_CACHEREJOIN:
-    m = new MMDSCacheRejoin;
+    m = MMDSCacheRejoin::factory::build();
        break;
   
   case MSG_MDS_DIRUPDATE:
-    m = new MDirUpdate();
+    m = MDirUpdate::factory::build();
     break;
 
   case MSG_MDS_DISCOVER:
-    m = new MDiscover();
+    m = MDiscover::factory::build();
     break;
   case MSG_MDS_DISCOVERREPLY:
-    m = new MDiscoverReply();
+    m = MDiscoverReply::factory::build();
     break;
 
   case MSG_MDS_FINDINO:
-    m = new MMDSFindIno;
+    m = MMDSFindIno::factory::build();
     break;
   case MSG_MDS_FINDINOREPLY:
-    m = new MMDSFindInoReply;
+    m = MMDSFindInoReply::factory::build();
     break;
 
   case MSG_MDS_OPENINO:
-    m = new MMDSOpenIno;
+    m = MMDSOpenIno::factory::build();
     break;
   case MSG_MDS_OPENINOREPLY:
-    m = new MMDSOpenInoReply;
+    m = MMDSOpenInoReply::factory::build();
     break;
 
   case MSG_MDS_SNAPUPDATE:
-    m = new MMDSSnapUpdate();
+    m = MMDSSnapUpdate::factory::build();
     break;
 
   case MSG_MDS_FRAGMENTNOTIFY:
-    m = new MMDSFragmentNotify;
+    m = MMDSFragmentNotify::factory::build();
     break;
 
   case MSG_MDS_EXPORTDIRDISCOVER:
-    m = new MExportDirDiscover();
+    m = MExportDirDiscover::factory::build();
     break;
   case MSG_MDS_EXPORTDIRDISCOVERACK:
-    m = new MExportDirDiscoverAck();
+    m = MExportDirDiscoverAck::factory::build();
     break;
   case MSG_MDS_EXPORTDIRCANCEL:
-    m = new MExportDirCancel();
+    m = MExportDirCancel::factory::build();
     break;
 
   case MSG_MDS_EXPORTDIR:
-    m = new MExportDir;
+    m = MExportDir::factory::build();
     break;
   case MSG_MDS_EXPORTDIRACK:
-    m = new MExportDirAck;
+    m = MExportDirAck::factory::build();
     break;
   case MSG_MDS_EXPORTDIRFINISH:
-    m = new MExportDirFinish;
+    m = MExportDirFinish::factory::build();
     break;
 
   case MSG_MDS_EXPORTDIRNOTIFY:
-    m = new MExportDirNotify();
+    m = MExportDirNotify::factory::build();
     break;
 
   case MSG_MDS_EXPORTDIRNOTIFYACK:
-    m = new MExportDirNotifyAck();
+    m = MExportDirNotifyAck::factory::build();
     break;
 
   case MSG_MDS_EXPORTDIRPREP:
-    m = new MExportDirPrep();
+    m = MExportDirPrep::factory::build();
     break;
 
   case MSG_MDS_EXPORTDIRPREPACK:
-    m = new MExportDirPrepAck();
+    m = MExportDirPrepAck::factory::build();
     break;
 
   case MSG_MDS_EXPORTCAPS:
-    m = new MExportCaps;
+    m = MExportCaps::factory::build();
     break;
   case MSG_MDS_EXPORTCAPSACK:
-    m = new MExportCapsAck;
+    m = MExportCapsAck::factory::build();
     break;
   case MSG_MDS_GATHERCAPS:
-    m = new MGatherCaps;
+    m = MGatherCaps::factory::build();
     break;
 
 
   case MSG_MDS_DENTRYUNLINK:
-    m = new MDentryUnlink;
+    m = MDentryUnlink::factory::build();
     break;
   case MSG_MDS_DENTRYLINK:
-    m = new MDentryLink;
+    m = MDentryLink::factory::build();
     break;
 
   case MSG_MDS_HEARTBEAT:
-    m = new MHeartbeat();
+    m = MHeartbeat::factory::build();
     break;
 
   case MSG_MDS_CACHEEXPIRE:
-    m = new MCacheExpire();
+    m = MCacheExpire::factory::build();
     break;
 
   case MSG_MDS_TABLE_REQUEST:
-    m = new MMDSTableRequest;
+    m = MMDSTableRequest::factory::build();
     break;
 
        /*  case MSG_MDS_INODEUPDATE:
-    m = new MInodeUpdate();
+    m = MInodeUpdate::factory::build();
     break;
        */
 
   case MSG_MDS_INODEFILECAPS:
-    m = new MInodeFileCaps();
+    m = MInodeFileCaps::factory::build();
     break;
 
   case MSG_MDS_LOCK:
-    m = new MLock();
+    m = MLock::factory::build();
     break;
 
   case MSG_MGR_BEACON:
-    m = new MMgrBeacon();
+    m = MMgrBeacon::factory::build();
     break;
 
   case MSG_MON_MGR_REPORT:
-    m = new MMonMgrReport();
+    m = MMonMgrReport::factory::build();
     break;
 
   case MSG_SERVICE_MAP:
-    m = new MServiceMap();
+    m = MServiceMap::factory::build();
     break;
 
   case MSG_MGR_MAP:
-    m = new MMgrMap();
+    m = MMgrMap::factory::build();
     break;
 
   case MSG_MGR_DIGEST:
-    m = new MMgrDigest();
+    m = MMgrDigest::factory::build();
     break;
 
   case MSG_MGR_OPEN:
-    m = new MMgrOpen();
+    m = MMgrOpen::factory::build();
     break;
 
   case MSG_MGR_CLOSE:
-    m = new MMgrClose();
+    m = MMgrClose::factory::build();
     break;
 
   case MSG_MGR_REPORT:
-    m = new MMgrReport();
+    m = MMgrReport::factory::build();
     break;
 
   case MSG_MGR_CONFIGURE:
-    m = new MMgrConfigure();
+    m = MMgrConfigure::factory::build();
     break;
 
   case MSG_TIMECHECK:
-    m = new MTimeCheck();
+    m = MTimeCheck::factory::build();
     break;
   case MSG_TIMECHECK2:
-    m = new MTimeCheck2();
+    m = MTimeCheck2::factory::build();
     break;
 
   case MSG_MON_HEALTH:
-    m = new MMonHealth();
+    m = MMonHealth::factory::build();
     break;
 
   case MSG_MON_HEALTH_CHECKS:
-    m = new MMonHealthChecks();
+    m = MMonHealthChecks::factory::build();
     break;
 
 #if defined(HAVE_XIO)
   case MSG_DATA_PING:
-    m = new MDataPing();
+    m = MDataPing::factory::build();
     break;
 #endif
     // -- simple messages without payload --
 
   case CEPH_MSG_SHUTDOWN:
-    m = new MGenericMessage(type);
+    m = MGenericMessage::factory::build(type);
     break;
 
   default:
@@ -857,7 +857,6 @@ Message *decode_message(CephContext *cct, int crcflags,
       if (cct->_conf->ms_die_on_bad_msg)
        ceph_abort();
     }
-    m->put();
     return 0;
   }
 
@@ -883,12 +882,11 @@ Message *decode_message(CephContext *cct, int crcflags,
       if (cct->_conf->ms_die_on_bad_msg)
        ceph_abort();
     }
-    m->put();
     return 0;
   }
 
   // done!
-  return m;
+  return m.detach();
 }
 
 void Message::encode_trace(bufferlist &bl, uint64_t features) const
index 796dbc456a3e801609af392b887013a2f9b8e0e3..6ffc1f2045a952eeeb84c130d375e86c55157bfb 100644 (file)
@@ -519,4 +519,13 @@ extern void encode_message(Message *m, uint64_t features, bufferlist& bl);
 extern Message *decode_message(CephContext *cct, int crcflags,
                                bufferlist::const_iterator& bl);
 
+template <class MessageType>
+class MessageFactory {
+public:
+template<typename... Args>
+  static typename MessageType::ref build(Args&&... args) {
+    return typename MessageType::ref(new MessageType(std::forward<Args>(args)...), false);
+  }
+};
+
 #endif
index f8b8fe39994f11adf8f466b6dd9e75905ed684e2..e069f1fdde6306b92b67662ca9ed3b2e99eb2fe6 100644 (file)
@@ -214,22 +214,18 @@ public:
 
 template<class T>
 class MessageDencoderImpl : public Dencoder {
-  T *m_object;
-  list<T*> m_list;
+  typename T::ref m_object;
+  list<typename T::ref> m_list;
 
 public:
-  MessageDencoderImpl() {
-    m_object = new T;
-  }
-  ~MessageDencoderImpl() override {
-    m_object->put();
-  }
+  MessageDencoderImpl() : m_object(T::factory::build()) {}
+  ~MessageDencoderImpl() override {}
 
   string decode(bufferlist bl, uint64_t seek) override {
     auto p = bl.cbegin();
     p.seek(seek);
     try {
-      Message *n = decode_message(g_ceph_context, 0, p);
+      Message::ref n(decode_message(g_ceph_context, 0, p), false);
       if (!n)
        throw std::runtime_error("failed to decode");
       if (n->get_type() != m_object->get_type()) {
@@ -237,8 +233,7 @@ public:
        ss << "decoded type " << n->get_type() << " instead of expected " << m_object->get_type();
        throw std::runtime_error(ss.str());
       }
-      m_object->put();
-      m_object = static_cast<T *>(n);
+      m_object = boost::static_pointer_cast<typename T::ref::element_type, std::remove_reference<decltype(n)>::type::element_type>(n);
     }
     catch (buffer::error& e) {
       return e.what();
@@ -253,7 +248,7 @@ public:
 
   void encode(bufferlist& out, uint64_t features) override {
     out.clear();
-    encode_message(m_object, features, out);
+    encode_message(m_object.get(), features, out);
   }
 
   void dump(ceph::Formatter *f) override {
@@ -271,7 +266,6 @@ public:
       i = m_list.size();
     if ((i == 0) || (i > m_list.size()))
       return "invalid id for generated object";
-    m_object->put();
     m_object = *(std::next(m_list.begin(), i-1));
     return string();
   }
index 2542c6bb21b2a5aa42c32253556435e06d1c308d..255c23f00d6d9461fbe466c70e57fec586119b71 100644 (file)
@@ -867,6 +867,3 @@ MESSAGE(MTimeCheck2)
 
 #include "messages/MWatchNotify.h"
 MESSAGE(MWatchNotify)
-
-#include "messages/PaxosServiceMessage.h"
-MESSAGE(PaxosServiceMessage)