]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mgr/ClusterState.h
update sources to v12.1.1
[ceph.git] / ceph / src / mgr / ClusterState.h
index ae08c75daa1a0d8f4d56e31a4f41dfffb9943fe0..9513c763bd0ad2790a5b01e2ba810fc281f3032b 100644 (file)
 #define CLUSTER_STATE_H_
 
 #include "mds/FSMap.h"
+#include "mon/MgrMap.h"
 #include "common/Mutex.h"
 
 #include "osdc/Objecter.h"
 #include "mon/MonClient.h"
 #include "mon/PGMap.h"
+#include "mgr/ServiceMap.h"
 
 class MMgrDigest;
 class MMonMgrReport;
@@ -36,8 +38,11 @@ protected:
   MonClient *monc;
   Objecter *objecter;
   FSMap fsmap;
+  ServiceMap servicemap;
   mutable Mutex lock;
 
+  MgrMap mgr_map;
+
   set<int64_t> existing_pools; ///< pools that exist, as of PGMap epoch
   PGMap pg_map;
   PGMap::Incremental pending_inc;
@@ -57,10 +62,12 @@ public:
   const bufferlist &get_health() const {return health_json;}
   const bufferlist &get_mon_status() const {return mon_status_json;}
 
-  ClusterState(MonClient *monc_, Objecter *objecter_);
+  ClusterState(MonClient *monc_, Objecter *objecter_, const MgrMap& mgrmap);
 
   void set_objecter(Objecter *objecter_);
   void set_fsmap(FSMap const &new_fsmap);
+  void set_mgr_map(MgrMap const &new_mgrmap);
+  void set_service_map(ServiceMap const &new_service_map);
 
   void notify_osdmap(const OSDMap &osd_map);
 
@@ -69,6 +76,13 @@ public:
     return fsmap.get_epoch() > 0;
   }
 
+  template<typename Callback, typename...Args>
+  void with_servicemap(Callback&& cb, Args&&...args) const
+  {
+    Mutex::Locker l(lock);
+    std::forward<Callback>(cb)(servicemap, std::forward<Args>(args)...);
+  }
+
   template<typename Callback, typename...Args>
   void with_fsmap(Callback&& cb, Args&&...args) const
   {
@@ -76,6 +90,13 @@ public:
     std::forward<Callback>(cb)(fsmap, std::forward<Args>(args)...);
   }
 
+  template<typename Callback, typename...Args>
+  void with_mgrmap(Callback&& cb, Args&&...args) const
+  {
+    Mutex::Locker l(lock);
+    std::forward<Callback>(cb)(mgr_map, std::forward<Args>(args)...);
+  }
+
   template<typename Callback, typename...Args>
   auto with_pgmap(Callback&& cb, Args&&...args) const ->
     decltype(cb(pg_map, std::forward<Args>(args)...))