]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: translate the state in rgw_data_sync_marker 20027/head
authorlvshanchun <lvshanchun@gmail.com>
Wed, 7 Feb 2018 05:40:00 +0000 (13:40 +0800)
committersamonlv <samonlv@tencent.com>
Fri, 23 Feb 2018 05:04:58 +0000 (13:04 +0800)
Signed-off-by: lvshanchun <lvshanchun@gmail.com>
src/rgw/rgw_data_sync.h

index ce3c3384f25148b2096dd66e632b957289547887..f18a6fbc66b1c69782d7d39f0a89225d9707a4ff 100644 (file)
@@ -132,7 +132,19 @@ struct rgw_data_sync_marker {
   }
 
   void dump(Formatter *f) const {
-    encode_json("state", (int)state, f);
+    const char *s{nullptr};
+    switch ((SyncState)state) {
+      case FullSync:
+        s = "full-sync";
+        break;
+      case IncrementalSync:
+        s = "incremental-sync";
+        break;
+      default:
+        s = "unknown";
+        break;
+    }
+    encode_json("status", s, f);
     encode_json("marker", marker, f);
     encode_json("next_step_marker", next_step_marker, f);
     encode_json("total_entries", total_entries, f);
@@ -140,9 +152,13 @@ struct rgw_data_sync_marker {
     encode_json("timestamp", utime_t(timestamp), f);
   }
   void decode_json(JSONObj *obj) {
-    int s;
-    JSONDecoder::decode_json("state", s, obj);
-    state = s;
+    std::string s;
+    JSONDecoder::decode_json("status", s, obj);
+    if (s == "full-sync") {
+      state = FullSync;
+    } else if (s == "incremental-sync") {
+      state = IncrementalSync;
+    }
     JSONDecoder::decode_json("marker", marker, obj);
     JSONDecoder::decode_json("next_step_marker", next_step_marker, obj);
     JSONDecoder::decode_json("total_entries", total_entries, obj);