]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw: expose api to generate reshard indexing key
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 24 May 2017 18:23:46 +0000 (11:23 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:57 +0000 (13:17 -0700)
So that we could use it as a marker when doing reshard_list.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw.cc
src/cls/rgw/cls_rgw_types.cc
src/cls/rgw/cls_rgw_types.h

index 3034b146c974be367d1c4d0cf22aae1eb7eb22e2..eb99d390d01c1981065a8054947dbae36bd12aa3 100644 (file)
@@ -3485,16 +3485,6 @@ static int rgw_cls_lc_get_head(cls_method_context_t hctx, bufferlist *in,  buffe
   return 0;
 }
 
-static void generate_reshard_key(const string& tenant, const string& bucket_name, string *key)
-{
-  *key = tenant + ":" + bucket_name;
-}
-
-static void generate_reshard_key(const cls_rgw_reshard_entry& entry, string *key)
-{
-  generate_reshard_key(entry.tenant, entry.bucket_name, key);
-}
-
 static int rgw_reshard_add(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
 {
   bufferlist::iterator in_iter = in->begin();
@@ -3509,7 +3499,7 @@ static int rgw_reshard_add(cls_method_context_t hctx, bufferlist *in, bufferlist
 
 
   string key;
-  generate_reshard_key(op.entry, &key);
+  op.entry.get_key(&key);
 
   bufferlist bl;
   ::encode(op.entry, bl);
@@ -3589,7 +3579,7 @@ static int rgw_reshard_get(cls_method_context_t hctx, bufferlist *in,  bufferlis
 
   string key;
   cls_rgw_reshard_entry  entry;
-  generate_reshard_key(op.entry, &key);
+  op.entry.get_key(&key);
   int ret = get_reshard_entry(hctx, key, &entry);
   if (ret < 0) {
     return ret;
@@ -3615,7 +3605,7 @@ static int rgw_reshard_remove(cls_method_context_t hctx, bufferlist *in, bufferl
 
   string key;
   cls_rgw_reshard_entry  entry;
-  generate_reshard_key(op.tenant, op.bucket_name, &key);
+  cls_rgw_reshard_entry::generate_key(op.tenant, op.bucket_name, &key);
   int ret = get_reshard_entry(hctx, key, &entry);
   if (ret < 0) {
     return ret;
index 7a24a3275348eee4ea114ab2ea5d1f20b3eb1562..cfb2f534007142a2f64fa8fa0ef73248f1b6b7d8 100644 (file)
@@ -566,6 +566,16 @@ void rgw_bucket_dir::dump(Formatter *f) const
   f->close_section();
 }
 
+void cls_rgw_reshard_entry::generate_key(const string& tenant, const string& bucket_name, string *key)
+{
+  *key = tenant + ":" + bucket_name;
+}
+
+void cls_rgw_reshard_entry::get_key(string *key) const
+{
+  generate_key(tenant, bucket_name, key);
+}
+
 void cls_rgw_reshard_entry::dump(Formatter *f) const
 {
   utime_t ut(time);
index 7b1adf638e95d7e38825e2929b3b7ad93b91025b..48d68da26334bd80d6c39ca234588afc5692cbbb 100644 (file)
@@ -1105,8 +1105,11 @@ struct cls_rgw_reshard_entry
     DECODE_FINISH(bl);
   }
 
-   void dump(Formatter *f) const;
+  void dump(Formatter *f) const;
   static void generate_test_instances(list<cls_rgw_reshard_entry*>& o);
+
+  static void generate_key(const string& tenant, const string& bucket_name, string *key);
+  void get_key(string *key) const;
 };
 WRITE_CLASS_ENCODER(cls_rgw_reshard_entry)