]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: translate the state in rgw_data_sync_marker
authorlvshanchun <lvshanchun@gmail.com>
Wed, 7 Feb 2018 05:40:00 +0000 (13:40 +0800)
committerCasey Bodley <cbodley@redhat.com>
Mon, 14 May 2018 17:28:03 +0000 (13:28 -0400)
Signed-off-by: lvshanchun <lvshanchun@gmail.com>
(cherry picked from commit 7ddca6e50d85380505134481d37734b4f1433f1a)

src/rgw/rgw_data_sync.h

index 51354a6f6be4493bb9fa131495d294d7f572c62a..0d0c14f368672514bcb79dfe1f683b22d4697f78 100644 (file)
@@ -128,7 +128,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);
@@ -136,9 +148,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);