]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove enum defination for storage class.
authorZhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Wed, 25 Jul 2018 04:25:53 +0000 (12:25 +0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 4 Jan 2019 03:00:22 +0000 (19:00 -0800)
Signed-off-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_lc_s3.cc
src/rgw/rgw_lc_s3.h

index e6ab1d8d5b7f99cddbb45ec506ca20a576e1a2ff..2fed865357adaee62a30c2908b877751f1a8af9e 100644 (file)
@@ -108,14 +108,14 @@ bool RGWLifecycleConfiguration::_add_rule(LCRule *rule)
       action.date = ceph::from_iso_8601(elem.second.get_date());
     }
     action.storage_class = elem.first;
-    op.transitions.emplace(action.storage_class, std::move(action));
+    op.transitions.emplace(elem.first, std::move(action));
   }
   for (const auto &elem : rule->get_noncur_transitions()) {
     transition_action action;
     action.days = elem.second.get_days();
     action.date = ceph::from_iso_8601(elem.second.get_date());
     action.storage_class = elem.first;
-    op.noncur_transitions.emplace(action.storage_class, std::move(action));
+    op.noncur_transitions.emplace(elem.first, std::move(action));
   }
   std::string prefix;
   if (rule->get_filter().has_prefix()){
index 04c5dff8c4b8cb418ea4b6493809f6cabb67e30b..bbe855f74cb7958fd05c861b6c9a3ab048d6a3e0 100644 (file)
@@ -38,13 +38,6 @@ typedef enum {
   lc_complete,
 }LC_BUCKET_STATUS;
 
-typedef enum {
-  standard_ia = 0,
-  onezone_ia,
-  glacier,
-  undefined,
-} STORAGE_CLASS;
-
 class LCExpiration
 {
 protected:
@@ -117,22 +110,10 @@ public:
     return date;
   }
 
-  string get_storage_class_str() const {
+  string get_storage_class() const {
     return storage_class;
   }
 
-  STORAGE_CLASS get_storage_class() const {
-    if (storage_class.compare("STANDARD_IA") == 0) {
-      return standard_ia;
-    } else if (storage_class.compare("ONEZONE_IA") == 0) {
-      return onezone_ia;
-    } else if (storage_class.compare("GLACIER") == 0) {
-      return glacier;
-    } else {
-      return undefined;
-    }
-  }
-
   bool has_days() const {
     return !days.empty();
   }
@@ -242,8 +223,8 @@ protected:
   LCExpiration noncur_expiration;
   LCExpiration mp_expiration;
   LCFilter filter;
-  map<int, LCTransition> transitions;
-  map<int, LCTransition> noncur_transitions;
+  map<string, LCTransition> transitions;
+  map<string, LCTransition> noncur_transitions;
   bool dm_expiration = false;
 
 public:
@@ -292,11 +273,11 @@ public:
     return dm_expiration;
   }
 
-  map<int, LCTransition>& get_transitions() {
+  map<string, LCTransition>& get_transitions() {
     return transitions;
   }
 
-  map<int, LCTransition>& get_noncur_transitions() {
+  map<string, LCTransition>& get_noncur_transitions() {
     return noncur_transitions;
   }
 
@@ -388,8 +369,8 @@ struct transition_action
 {
   int days;
   boost::optional<ceph::real_time> date;
-  int storage_class;
-  transition_action() : days(0), storage_class(standard_ia) {}
+  string storage_class;
+  transition_action() : days(0) {}
 };
 
 struct lc_op
@@ -401,8 +382,8 @@ struct lc_op
   int mp_expiration{0};
   boost::optional<ceph::real_time> expiration_date;
   boost::optional<RGWObjTags> obj_tags;
-  map<int, transition_action> transitions;
-  map<int, transition_action> noncur_transitions;
+  map<string, transition_action> transitions;
+  map<string, transition_action> noncur_transitions;
   
   void dump(Formatter *f) const;
 };
index 21bf202b61fc168d9d8d2071370cb6048df85746..0b9ed0da95b5bee98f9d6df5df56c3c68bb0ad16 100644 (file)
@@ -358,7 +358,7 @@ XMLObj *RGWLCXMLParser_S3::alloc_obj(const char *el)
   return obj;
 }
 
-bool check_date(const string& _date)
+static bool check_date(const string& _date)
 {
   boost::optional<ceph::real_time> date = ceph::from_iso_8601(_date);
   if (boost::none == date) {
index affa3b758ec31f39ffdcf0d2843f3aff2291a11e..e9815e2fc3ea0d6b3f4e028a349b21c1af50da38 100644 (file)
@@ -330,5 +330,4 @@ public:
   void dump_xml(Formatter *f) const;
 };
 
-bool check_date(const string& _date);
 #endif