From: Yehuda Sadeh Date: Tue, 19 Nov 2019 18:51:49 +0000 (-0800) Subject: rgw: sync: add mode (system, user) as a pipe param X-Git-Tag: v15.1.0~22^2~53 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7951ccb7606838244ea5259a4163e132a9087fe8;p=ceph.git rgw: sync: add mode (system, user) as a pipe param Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 269f5f3c545b..347925f902d7 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -947,6 +947,15 @@ void rgw_sync_pipe_params::dump(Formatter *f) const encode_json("source", source, f); encode_json("dest", dest, f); encode_json("priority", priority, f); + string s; + switch (mode) { + case MODE_SYSTEM: + s = "system"; + break; + default: + s = "user"; + } + encode_json("mode", s, f); } void rgw_sync_pipe_params::decode_json(JSONObj *obj) @@ -954,6 +963,13 @@ void rgw_sync_pipe_params::decode_json(JSONObj *obj) JSONDecoder::decode_json("source", source, obj); JSONDecoder::decode_json("dest", dest, obj); JSONDecoder::decode_json("priority", priority, obj); + string s; + JSONDecoder::decode_json("mode", s, obj); + if (s == "system") { + mode = MODE_SYSTEM; + } else { + mode = MODE_USER; + } } diff --git a/src/rgw/rgw_sync_policy.h b/src/rgw/rgw_sync_policy.h index ae7782129293..07623583a3bb 100644 --- a/src/rgw/rgw_sync_policy.h +++ b/src/rgw/rgw_sync_policy.h @@ -301,6 +301,10 @@ WRITE_CLASS_ENCODER(rgw_sync_pipe_dest_params) struct rgw_sync_pipe_params { rgw_sync_pipe_source_params source; rgw_sync_pipe_dest_params dest; + enum Mode { + MODE_SYSTEM = 0, + MODE_USER = 1, + } mode{MODE_SYSTEM}; int32_t priority{0}; void encode(bufferlist& bl) const { @@ -308,6 +312,7 @@ struct rgw_sync_pipe_params { encode(source, bl); encode(dest, bl); encode(priority, bl); + encode((uint8_t)mode, bl); ENCODE_FINISH(bl); } @@ -316,6 +321,9 @@ struct rgw_sync_pipe_params { decode(source, bl); decode(dest, bl); decode(priority, bl); + uint8_t m; + decode(m, bl); + mode = (Mode)m; DECODE_FINISH(bl); }