diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-03-20 10:38:30 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-03-22 11:29:11 -0700 |
commit | 6909041e4c9e1cf6ddaec2c74f7f91af000525be (patch) | |
tree | 0c85f15c06ab61e485b1a6e09a86fa43787a5fb8 | |
parent | fe61d9967b5c87c13c6c51c2edcb6568bf45d111 (diff) | |
download | ceph-6909041e4c9e1cf6ddaec2c74f7f91af000525be.tar.gz |
rgw: use new cls_log listing interface
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_metadata.cc | 9 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 17 | ||||
-rw-r--r-- | src/rgw/rgw_rados.h | 3 |
3 files changed, 29 insertions, 0 deletions
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<cls_log_entry>& 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 963cd3a2725..a8ac4acd436 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<cls_log_entry>& 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 12ede97cb40..b3719aa88f1 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" @@ -970,6 +971,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<cls_log_entry>& entries, string& marker, bool *truncated); /// clean up/process any temporary objects older than given date[/time] int remove_temp_objects(string date, string time); |