diff options
author | Ji Chen <insomnia@139.com> | 2016-06-13 04:32:34 +0200 |
---|---|---|
committer | Ji Chen <insomnia@139.com> | 2016-07-22 06:22:12 +0200 |
commit | abe4b1378cc0e23e0da9c76c034c6d592b81b105 (patch) | |
tree | 545e3b31f4cb613aa5035eb01ffd0132e5309d29 /src/rgw/rgw_lc_s3.h | |
parent | Merge pull request #9089 from SirishaGuduru/bugfix15603 (diff) | |
download | ceph-abe4b1378cc0e23e0da9c76c034c6d592b81b105.tar.xz ceph-abe4b1378cc0e23e0da9c76c034c6d592b81b105.zip |
RGW:lifecycle feature[rebase]
As same as amazon S3 interface,"PUT Bucket lifecycle" and
"DELETE Bucket lifecycle" have been implemented,
"GET Bucket lifecycle" not realized yet as S3cmd has not
realize it also.
The feature`s main point is to remove expire file per day.
Files transfer from hot layer to cold layer is not supported.
ToDo:Maybe to transfer from replicate pool to EC pool or
from ssd to sata pool will be valuable.
Now put all buckets which should do lifecycle into shard
objects in .rgw.lc pool.
lifecycle config file format:
<LifecycleConfiguration>
<Rule>
<ID>sample-rule</ID>
<Prefix></Prefix>
<Status>enable</Status>
<Expiration>
<Days>1</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
Signed-off-by: Ji Chen <insomnia@139.com>
Diffstat (limited to 'src/rgw/rgw_lc_s3.h')
-rw-r--r-- | src/rgw/rgw_lc_s3.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/rgw/rgw_lc_s3.h b/src/rgw/rgw_lc_s3.h new file mode 100644 index 00000000000..1de47d5fb60 --- /dev/null +++ b/src/rgw/rgw_lc_s3.h @@ -0,0 +1,104 @@ +#ifndef CEPH_RGW_LC_S3_H +#define CEPH_RGW_LC_S3_H + +#include <map> +#include <string> +#include <iostream> +#include <include/types.h> + +#include <expat.h> + +#include "include/str_list.h" +#include "rgw_lc.h" +#include "rgw_xml.h" + + + +using namespace std; + +class LCRule_S3 : public LCRule, public XMLObj +{ +public: + LCRule_S3() {} + ~LCRule_S3() {} + + void to_xml(CephContext *cct, ostream& out); + bool xml_end(const char *el); + bool xml_start(const char *el, const char **attr); +}; + +class LCID_S3 : public XMLObj +{ +public: + LCID_S3() {} + ~LCID_S3() {} + string& to_str() { return data; } +}; + +class LCPrefix_S3 : public XMLObj +{ +public: + LCPrefix_S3() {} + ~LCPrefix_S3() {} + string& to_str() { return data; } +}; + +class LCStatus_S3 : public XMLObj +{ +public: + LCStatus_S3() {} + ~LCStatus_S3() {} + string& to_str() { return data; } +}; + +class LCDays_S3 : public XMLObj +{ +public: + LCDays_S3() {} + ~LCDays_S3() {} + string& to_str() { return data; } +}; + +class LCExpiration_S3 : public LCExpiration, public XMLObj +{ +public: + LCExpiration_S3() {} + ~LCExpiration_S3() {} + + bool xml_end(const char *el); + void to_xml(ostream& out) { + out << "<Expiration>" << "<Days>" << days << "</Days>"<< "</Expiration>"; + } +}; + +class RGWLCXMLParser_S3 : public RGWXMLParser +{ + CephContext *cct; + + XMLObj *alloc_obj(const char *el); +public: + RGWLCXMLParser_S3(CephContext *_cct) : cct(_cct) {} +}; + +class RGWLifecycleConfiguration_S3 : public RGWLifecycleConfiguration, public XMLObj +{ +public: + RGWLifecycleConfiguration_S3(CephContext *_cct) : RGWLifecycleConfiguration(_cct) {} + ~RGWLifecycleConfiguration_S3() {} + + bool xml_end(const char *el); + + void to_xml(ostream& out) { + out << "<LifecycleConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">"; + multimap<string, LCRule>::iterator iter; + for (iter = rule_map.begin(); iter != rule_map.end(); ++iter) { + LCRule_S3& rule = static_cast<LCRule_S3&>(iter->second); + rule.to_xml(cct, out); + } + out << "</LifecycleConfiguration>"; + } + int rebuild(RGWRados *store, RGWLifecycleConfiguration& dest); +}; + + +#endif |