summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-03-20 10:38:30 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-03-20 10:38:30 -0700
commita768eaecf06447c395bbc292ec50c209c0367639 (patch)
tree5a9f6bd36e315d3c2aea8f08a4b19f055c433b00
parent80ac042440223d7344eaab6e37a3913bbf815c3d (diff)
downloadceph-a768eaecf06447c395bbc292ec50c209c0367639.tar.gz
rgw: use new cls_log listing interface
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_metadata.cc9
-rw-r--r--src/rgw/rgw_rados.cc17
-rw-r--r--src/rgw/rgw_rados.h3
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 d2b266d7792..2625719780e 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 372bc60c128..47b57246075 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);