]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: more constness 17748/head
authorKefu Chai <kchai@redhat.com>
Thu, 14 Sep 2017 08:11:15 +0000 (16:11 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 15 Sep 2017 04:20:58 +0000 (12:20 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
15 files changed:
src/mon/AuthMonitor.cc
src/mon/AuthMonitor.h
src/mon/ConfigKeyService.cc
src/mon/ConfigKeyService.h
src/mon/HealthMonitor.cc
src/mon/HealthMonitor.h
src/mon/LogMonitor.cc
src/mon/LogMonitor.h
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h
src/mon/MgrStatMonitor.cc
src/mon/MgrStatMonitor.h
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/mon/PaxosService.h

index c9c836dc5151d99bedb09bcd156ce822575c6665..ada1ddb4a913319e81b239552cb3026280dc0d71 100644 (file)
@@ -271,7 +271,7 @@ void AuthMonitor::encode_full(MonitorDBStore::TransactionRef t)
   put_version_latest_full(t, version);
 }
 
-version_t AuthMonitor::get_trim_to()
+version_t AuthMonitor::get_trim_to() const
 {
   unsigned max = g_conf->paxos_max_join_drift * 2;
   version_t version = get_last_committed();
index 18b847d6456f8f368bd1066542ead4c336207ca3..8f3ca30245b026ac25a08cae55345ef17c83ba49 100644 (file)
@@ -153,7 +153,7 @@ private:
   // propose pending update to peers
   void encode_pending(MonitorDBStore::TransactionRef t) override;
   void encode_full(MonitorDBStore::TransactionRef t) override;
-  version_t get_trim_to() override;
+  version_t get_trim_to() const override;
 
   bool preprocess_query(MonOpRequestRef op) override;  // true if processed.
   bool prepare_update(MonOpRequestRef op) override;
index 29ae9d959427aa4c38872fddb33607b44b1c6e24..cd0587d2e2fef2b1447f11d60106fb41d390c68c 100644 (file)
@@ -40,7 +40,7 @@ int ConfigKeyService::store_get(const string &key, bufferlist &bl)
   return mon->store->get(STORE_PREFIX, key, bl);
 }
 
-void ConfigKeyService::get_store_prefixes(set<string>& s)
+void ConfigKeyService::get_store_prefixes(set<string>& s) const
 {
   s.insert(STORE_PREFIX);
 }
index a20969939e1171c6b347bfb717220b4623fc0ea5..690e512500d66bac42eac1f42b197739479698af 100644 (file)
@@ -79,7 +79,7 @@ public:
   string get_name() const override {
     return "config_key";
   }
-  virtual void get_store_prefixes(set<string>& s);
+  void get_store_prefixes(set<string>& s) const;
   /**
    * @} // ConfigKeyService_Inherited_h
    */
index 53c9999e753dd21be5bac4f48ee0bd525ec0380e..e5c331714e954db6472c440b9a919049c327eeb3 100644 (file)
@@ -140,7 +140,7 @@ void HealthMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   encode_health(pending_health, t);
 }
 
-version_t HealthMonitor::get_trim_to()
+version_t HealthMonitor::get_trim_to() const
 {
   // we don't actually need *any* old states, but keep a few.
   if (version > 5) {
index 073a4e68c59153d131711201b06af33b839d2576..50a1699de658fb94530189905265f3c0b5642011 100644 (file)
@@ -46,7 +46,7 @@ public:
   void update_from_paxos(bool *need_bootstrap) override;
   void create_pending() override;
   void encode_pending(MonitorDBStore::TransactionRef t) override;
-  version_t get_trim_to() override;
+  version_t get_trim_to() const override;
 
   void encode_full(MonitorDBStore::TransactionRef t) override { }
 
index 90524902466540a90391259aa44133c080416c99..60f71e108bd2bd1b1fc23386ba84733b3a98704a 100644 (file)
@@ -234,7 +234,7 @@ void LogMonitor::encode_full(MonitorDBStore::TransactionRef t)
   put_version_latest_full(t, summary.version);
 }
 
-version_t LogMonitor::get_trim_to()
+version_t LogMonitor::get_trim_to() const
 {
   if (!mon->is_leader())
     return 0;
index 0bb5e366cb905b456d35a41104900529e48f535a..d2f082596c5e45fdc34c6078298b10569bc0eed5 100644 (file)
@@ -136,7 +136,7 @@ private:
   // propose pending update to peers
   void encode_pending(MonitorDBStore::TransactionRef t) override;
   void encode_full(MonitorDBStore::TransactionRef t) override;
-  version_t get_trim_to() override;
+  version_t get_trim_to() const override;
   bool preprocess_query(MonOpRequestRef op) override;  // true if processed.
   bool prepare_update(MonOpRequestRef op) override;
 
index c3f8b94ba5bcc3b889e64098c6498bff50fa71b2..b358d9add40a6ebc6646e42cddbee0bbced35345 100644 (file)
@@ -241,7 +241,7 @@ void MDSMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   encode_health(new_checks, t);
 }
 
-version_t MDSMonitor::get_trim_to()
+version_t MDSMonitor::get_trim_to() const
 {
   version_t floor = 0;
   if (g_conf->mon_mds_force_trim_to > 0 &&
index 0bf51adfe60d8f0c7fa701e485605388ee462809..bd1045ade2e13c73c2075fb79b12fec57063283e 100644 (file)
@@ -48,7 +48,7 @@ class MDSMonitor : public PaxosService {
   void encode_pending(MonitorDBStore::TransactionRef t) override;
   // we don't require full versions; don't encode any.
   void encode_full(MonitorDBStore::TransactionRef t) override { }
-  version_t get_trim_to() override;
+  version_t get_trim_to() const override;
 
   bool preprocess_query(MonOpRequestRef op) override;  // true if processed.
   bool prepare_update(MonOpRequestRef op) override;
index 2e26015c7cd0c84ae51345a88783394ecf655679..022a583cdc5f3f7688c5c8678fc62e248b057cd9 100644 (file)
@@ -127,7 +127,7 @@ void MgrStatMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   encode_health(pending_health_checks, t);
 }
 
-version_t MgrStatMonitor::get_trim_to()
+version_t MgrStatMonitor::get_trim_to() const
 {
   // we don't actually need *any* old states, but keep a few.
   if (version > 5) {
index 4f076105fb0cf72991c28a7cb1df67b42a50f42b..3b1d54b5d01616513472689dab904ca87452026f 100644 (file)
@@ -30,7 +30,7 @@ public:
   void update_from_paxos(bool *need_bootstrap) override;
   void create_pending() override;
   void encode_pending(MonitorDBStore::TransactionRef t) override;
-  version_t get_trim_to() override;
+  version_t get_trim_to() const override;
 
   bool definitely_converted_snapsets() const {
     return digest.definitely_converted_snapsets();
index bf0143d2914d9f0a1ac9a6ab8c6b61eaad77b766..e0dd2946a4b653ef1b9361cee42a639d8ff3b17e 100644 (file)
@@ -264,7 +264,7 @@ void OSDMonitor::create_initial()
   dout(20) << " full crc " << pending_inc.full_crc << dendl;
 }
 
-void OSDMonitor::get_store_prefixes(std::set<string>& s)
+void OSDMonitor::get_store_prefixes(std::set<string>& s) const
 {
   s.insert(service_name);
   s.insert(OSD_PG_CREATING_PREFIX);
@@ -1311,7 +1311,7 @@ void OSDMonitor::share_map_with_random_osd()
   // elsewhere) as they may still need to request older values.
 }
 
-version_t OSDMonitor::get_trim_to()
+version_t OSDMonitor::get_trim_to() const
 {
   if (mon->get_quorum().empty()) {
     dout(10) << __func__ << ": quorum not formed" << dendl;
index e4b1eb7f953f3e0079b8f76ca59842e09150cffb..583665d10b9c598c7a172167cb9695aa4610e3fa 100644 (file)
@@ -165,7 +165,7 @@ public:
   // svc
 public:  
   void create_initial() override;
-  void get_store_prefixes(std::set<string>& s) override;
+  void get_store_prefixes(std::set<string>& s) const override;
 
 private:
   void update_from_paxos(bool *need_bootstrap) override;
@@ -238,7 +238,7 @@ private:
   bool prepare_update(MonOpRequestRef op) override;
   bool should_propose(double &delay) override;
 
-  version_t get_trim_to() override;
+  version_t get_trim_to() const override;
 
   bool can_mark_down(int o);
   bool can_mark_up(int o);
index fb383423991c605adffc42b51705d8500b20a191..bf989d1385fc02e7307182d65cc9e2b9af4fda52 100644 (file)
@@ -90,7 +90,7 @@ protected:
   version_t format_version;
 
 public:
-  const health_check_map_t& get_health_checks() {
+  const health_check_map_t& get_health_checks() const {
     return health_checks;
   }
 
@@ -152,12 +152,12 @@ public:
    *
    * @returns The service's name.
    */
-  string get_service_name() { return service_name; }
+  const string& get_service_name() const { return service_name; }
 
   /**
    * Get the store prefixes we utilize
    */
-  virtual void get_store_prefixes(set<string>& s) {
+  virtual void get_store_prefixes(set<string>& s) const {
     s.insert(service_name);
   }
   
@@ -481,7 +481,7 @@ public:
    *
    * @returns true if we are proposing; false otherwise.
    */
-  bool is_proposing() {
+  bool is_proposing() const {
     return proposing;
   }
 
@@ -492,7 +492,7 @@ public:
    *
    * @returns true if in state ACTIVE; false otherwise.
    */
-  bool is_active() {
+  bool is_active() const {
     return
       !is_proposing() &&
       (paxos->is_active() || paxos->is_updating() || paxos->is_writing());
@@ -510,7 +510,7 @@ public:
    * @param ver The version we want to check if is readable
    * @returns true if it is readable; false otherwise
    */
-  bool is_readable(version_t ver = 0) {
+  bool is_readable(version_t ver = 0) const {
     if (ver > get_last_committed() ||
        !paxos->is_readable(0) ||
        get_last_committed() == 0)
@@ -529,7 +529,7 @@ public:
    *
    * @returns true if writeable; false otherwise
    */
-  bool is_writeable() {
+  bool is_writeable() const {
     return is_write_ready(); 
   }
 
@@ -539,7 +539,7 @@ public:
    *
    * @returns true if we are ready to be written to; false otherwise.
    */
-  bool is_write_ready() {
+  bool is_write_ready() const {
     return is_active() && have_pending;
   }
 
@@ -674,7 +674,7 @@ public:
    * @returns the version we should trim to; if we return zero, it should be
    *         assumed that there's no version to trim to.
    */
-  virtual version_t get_trim_to() {
+  virtual version_t get_trim_to() const {
     return 0;
   }