]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: sync: add mode (system, user) as a pipe param
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 19 Nov 2019 18:51:49 +0000 (10:51 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:38 +0000 (10:20 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_json_enc.cc
src/rgw/rgw_sync_policy.h

index 269f5f3c545b040094659bb352d688a3b0f2409b..347925f902d7b05d69dfe8023285ce83f7e4a0f5 100644 (file)
@@ -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;
+  }
 }
 
 
index ae7782129293c8aee5ca389eb111eadf6a7e0838..07623583a3bbe506a54b8f9fb46153cebb4ff762 100644 (file)
@@ -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);
   }