]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use new cls_log listing interface
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 20 Mar 2013 17:38:30 +0000 (10:38 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 8 May 2013 17:57:45 +0000 (10:57 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_metadata.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index ff4f8697db3819d0d71272de00785fc325944337..5ee7444c0ad11430f35833edf35ae900f3b21591 100644 (file)
@@ -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()
index 5ce8a2606638a7560ac6cd9ce7285733f9032fab..5d45f99c4ea573ea9d4426a3984aa8e652162388 100644 (file)
@@ -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();
index 28cfd5bd7ca05f9801faae5587f9966ead6ca790..b1a0daf1210a398e635843518065269df36fa6c7 100644 (file)
@@ -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<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);