]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mon/health_check.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / mon / health_check.h
index bff9166b12da24e1523bf5187ca3949468385007..4e74637f9e53d99622e8516cad9ff54653490ed9 100644 (file)
@@ -74,7 +74,7 @@ struct health_mute_t {
   std::string code;
   utime_t ttl;
   bool sticky = false;
-  string summary;
+  std::string summary;
   int64_t count;
 
   DENC(health_mute_t, v, p) {
@@ -119,8 +119,8 @@ struct health_check_map_t {
   }
 
   void dump(ceph::Formatter *f) const {
-    for (auto& p : checks) {
-      f->dump_object(p.first.c_str(), p.second);
+    for (auto& [code, check] : checks) {
+      f->dump_object(code, check);
     }
   }
 
@@ -173,18 +173,15 @@ struct health_check_map_t {
   }
 
   void merge(const health_check_map_t& o) {
-    for (auto& p : o.checks) {
-      auto q = checks.find(p.first);
-      if (q == checks.end()) {
-       // new check
-       checks[p.first] = p.second;
-      } else {
-       // merge details, and hope the summary matches!
-       q->second.detail.insert(
-         q->second.detail.end(),
-         p.second.detail.begin(),
-         p.second.detail.end());
-       q->second.count += p.second.count;
+    for (auto& [code, check] : o.checks) {
+      auto [it, new_check] = checks.try_emplace(code, check);
+      if (!new_check) {
+        // merge details, and hope the summary matches!
+        it->second.detail.insert(
+          it->second.detail.end(),
+          check.detail.begin(),
+          check.detail.end());
+        it->second.count += check.count;
       }
     }
   }