From: Zhang Shaowen Date: Wed, 25 Jul 2018 04:25:53 +0000 (+0800) Subject: rgw: remove enum defination for storage class. X-Git-Tag: v14.1.0~314^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e1d2af99237d97a32cc3cdf2d4738dc8a746a54;p=ceph.git rgw: remove enum defination for storage class. Signed-off-by: Zhang Shaowen --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index e6ab1d8d5b7f..2fed865357ad 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -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()){ diff --git a/src/rgw/rgw_lc.h b/src/rgw/rgw_lc.h index 04c5dff8c4b8..bbe855f74cb7 100644 --- a/src/rgw/rgw_lc.h +++ b/src/rgw/rgw_lc.h @@ -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 transitions; - map noncur_transitions; + map transitions; + map noncur_transitions; bool dm_expiration = false; public: @@ -292,11 +273,11 @@ public: return dm_expiration; } - map& get_transitions() { + map& get_transitions() { return transitions; } - map& get_noncur_transitions() { + map& get_noncur_transitions() { return noncur_transitions; } @@ -388,8 +369,8 @@ struct transition_action { int days; boost::optional 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 expiration_date; boost::optional obj_tags; - map transitions; - map noncur_transitions; + map transitions; + map noncur_transitions; void dump(Formatter *f) const; }; diff --git a/src/rgw/rgw_lc_s3.cc b/src/rgw/rgw_lc_s3.cc index 21bf202b61fc..0b9ed0da95b5 100644 --- a/src/rgw/rgw_lc_s3.cc +++ b/src/rgw/rgw_lc_s3.cc @@ -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 date = ceph::from_iso_8601(_date); if (boost::none == date) { diff --git a/src/rgw/rgw_lc_s3.h b/src/rgw/rgw_lc_s3.h index affa3b758ec3..e9815e2fc3ea 100644 --- a/src/rgw/rgw_lc_s3.h +++ b/src/rgw/rgw_lc_s3.h @@ -330,5 +330,4 @@ public: void dump_xml(Formatter *f) const; }; -bool check_date(const string& _date); #endif