]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add BucketTrimStatus
authorCasey Bodley <cbodley@redhat.com>
Fri, 1 Sep 2017 16:37:56 +0000 (12:37 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 10 Nov 2017 18:23:01 +0000 (13:23 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_sync_log_trim.cc
src/rgw/rgw_sync_log_trim.h

index 4eaddf717217f48708c88d6ef0db4214c76e1e45..a83f37cd288970ac0c4d864f8d7694199fa01f3e 100644 (file)
 
 #include "common/bounded_key_counter.h"
 #include "common/errno.h"
+#include "rgw_sync_log_trim.h"
 #include "rgw_cr_rados.h"
 #include "rgw_metadata.h"
 #include "rgw_rados.h"
-#include "rgw_sync_log_trim.h"
 #include "rgw_sync.h"
 
 #include <boost/asio/yield.hpp>
@@ -35,6 +35,9 @@
 using rgw::BucketTrimConfig;
 using BucketChangeCounter = BoundedKeyCounter<std::string, int>;
 
+const std::string rgw::BucketTrimStatus::oid = "bilog.trim";
+using rgw::BucketTrimStatus;
+
 
 // watch/notify api for gateways to coordinate about which buckets to trim
 enum TrimNotifyType {
@@ -614,7 +617,7 @@ class BucketTrimManager::Impl : public TrimCounters::Server {
 
   Impl(RGWRados *store, const BucketTrimConfig& config)
     : store(store), config(config),
-      status_obj(store->get_zone_params().log_pool, "bilog.trim"),
+      status_obj(store->get_zone_params().log_pool, BucketTrimStatus::oid),
       counter(config.counter_size),
       watcher(store, status_obj, this)
   {}
index ea47734e23820aa594daebaf133db5ebe4d10274..e54a74a582d8ab0996c54fd0ccaa240e1712eb16 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <memory>
 #include <boost/utility/string_view.hpp>
+#include "include/encoding.h"
 
 class CephContext;
 class RGWCoroutine;
@@ -69,6 +70,27 @@ class BucketTrimManager : public BucketChangeObserver {
   RGWCoroutine* create_bucket_trim_cr();
 };
 
+/// provides persistent storage for the trim manager's current position in the
+/// list of bucket instance metadata
+struct BucketTrimStatus {
+  std::string marker; //< metadata key of current bucket instance
+
+  void encode(bufferlist& bl) const {
+    ENCODE_START(1, 1, bl);
+    ::encode(marker, bl);
+    ENCODE_FINISH(bl);
+  }
+  void decode(bufferlist::iterator& p) {
+    DECODE_START(1, p);
+    ::decode(marker, p);
+    DECODE_FINISH(p);
+  }
+
+  static const std::string oid;
+};
+
 } // namespace rgw
 
+WRITE_CLASS_ENCODER(rgw::BucketTrimStatus);
+
 #endif // RGW_SYNC_LOG_TRIM_H