From: Yehuda Sadeh Date: Wed, 20 Mar 2013 17:38:30 +0000 (-0700) Subject: rgw: use new cls_log listing interface X-Git-Tag: v0.67-rc1~128^2~173 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=75ada775ac1d26a8ddcdd5445565bf0f73b4920f;p=ceph.git rgw: use new cls_log listing interface Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index ff4f8697db3..5ee7444c0ad 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -25,6 +25,15 @@ public: utime_t now = ceph_clock_now(cct); return store->time_log_add(oid, now, section, key, bl); } + int list_entries(RGWRados *store, string& section, string& key, + utime_t& from_time, utime_t& end_time, + list& entries, + string& marker, bool *truncated) { + string oid; + + store->shard_name(prefix, cct->_conf->rgw_md_log_max_shards, section, key, oid); + return store->time_log_list(oid, from_time, end_time, 0, entries, marker, truncated); + } }; obj_version& RGWMetadataObject::get_version() diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 5ce8a260663..5d45f99c4ea 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1101,6 +1101,23 @@ int RGWRados::time_log_add(const string& oid, const utime_t& ut, string& section return r; } +int RGWRados::time_log_list(const string& oid, utime_t& start_time, utime_t& end_time, + int max_entries, list& entries, string& marker, bool *truncated) +{ + librados::IoCtx io_ctx; + + librados::ObjectReadOperation op; + cls_log_list(op, start_time, end_time, marker, max_entries, entries, &marker, truncated); + + bufferlist obl; + + int ret = io_ctx.operate(oid, &op, &obl); + if (ret < 0) + return ret; + + return 0; +} + int RGWRados::decode_policy(bufferlist& bl, ACLOwner *owner) { bufferlist::iterator i = bl.begin(); diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 28cfd5bd7ca..b1a0daf1210 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -7,6 +7,7 @@ #include "rgw_common.h" #include "cls/rgw/cls_rgw_types.h" #include "cls/version/cls_version_types.h" +#include "cls/log/cls_log_types.h" #include "rgw_log.h" #include "rgw_metadata.h" @@ -979,6 +980,8 @@ public: void shard_name(const string& prefix, unsigned max_shards, string& key, string& name); void shard_name(const string& prefix, unsigned max_shards, string& section, string& key, string& name); int time_log_add(const string& oid, const utime_t& ut, string& section, string& key, bufferlist& bl); + int time_log_list(const string& oid, utime_t& start_time, utime_t& end_time, + int max_entries, list& entries, string& marker, bool *truncated); /// clean up/process any temporary objects older than given date[/time] int remove_temp_objects(string date, string time);