From bc70d67f6af07cc764cbf8e904cb692781e1df20 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Tue, 13 Oct 2015 12:31:39 +0200 Subject: [PATCH] rgw: move dump functions into rgw_json_enc.cc Signed-off-by: Orit Wasserman --- src/rgw/rgw_json_enc.cc | 33 +++++++++++++++++++++++++++++++++ src/rgw/rgw_sync.h | 31 +++---------------------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 1b07e3799e5f6..183a3e083d3dd 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -1106,3 +1106,36 @@ void rgw_slo_entry::decode_json(JSONObj *obj) JSONDecoder::decode_json("etag", etag, obj); JSONDecoder::decode_json("size_bytes", size_bytes, obj); }; + +void rgw_meta_sync_info::dump(Formatter *f) const +{ + string s; + switch ((SyncState)state) { + case StateInit: + s = "init"; + break; + case StateBuildingFullSyncMaps: + s = "building-full-sync-maps"; + break; + case StateSync: + s = "sync"; + break; + default: + s = "unknown"; + break; + } + encode_json("status", s, f); + encode_json("num_shards", num_shards, f); +} + +void rgw_meta_sync_marker::dump(Formatter *f) const +{ + encode_json("state", (int)state, f); + encode_json("marker", marker, f); + encode_json("next_step_marker", next_step_marker, f); +} + +void rgw_meta_sync_status::dump(Formatter *f) const { + encode_json("info", sync_info, f); + encode_json("markers", sync_markers, f); +} diff --git a/src/rgw/rgw_sync.h b/src/rgw/rgw_sync.h index 495a0b339426b..f5f33da402fc6 100644 --- a/src/rgw/rgw_sync.h +++ b/src/rgw/rgw_sync.h @@ -39,25 +39,7 @@ struct rgw_meta_sync_info { DECODE_FINISH(bl); } - void dump(Formatter *f) const { - string s; - switch ((SyncState)state) { - case StateInit: - s = "init"; - break; - case StateBuildingFullSyncMaps: - s = "building-full-sync-maps"; - break; - case StateSync: - s = "sync"; - break; - default: - s = "unknown"; - break; - } - encode_json("status", s, f); - encode_json("num_shards", num_shards, f); - } + void dump(Formatter *f) const; rgw_meta_sync_info() : state((int)StateInit), num_shards(0) {} }; @@ -90,11 +72,7 @@ struct rgw_meta_sync_marker { DECODE_FINISH(bl); } - void dump(Formatter *f) const { - encode_json("state", (int)state, f); - encode_json("marker", marker, f); - encode_json("next_step_marker", next_step_marker, f); - } + void dump(Formatter *f) const; }; WRITE_CLASS_ENCODER(rgw_meta_sync_marker) @@ -118,10 +96,7 @@ struct rgw_meta_sync_status { DECODE_FINISH(bl); } - void dump(Formatter *f) const { - encode_json("info", sync_info, f); - encode_json("markers", sync_markers, f); - } + void dump(Formatter *f) const; }; WRITE_CLASS_ENCODER(rgw_meta_sync_status) -- 2.39.5