#include "rgw_cr_rados.h"
#include "cls/lock/cls_lock_client.h"
+#include "cls/rgw/cls_rgw_client.h"
#include <boost/asio/yield.hpp>
return 0;
}
+static std::string normalize_shard_marker(const std::string& marker)
+{
+ // markers may be formatted with '<shard-id>#' at the beginning.
+ // CLSRGWIssueBILogTrim would fix this for us, but it's synchronous
+ auto p = marker.find(BucketIndexShardsManager::KEY_VALUE_SEPARATOR);
+ if (p == marker.npos) {
+ return marker;
+ }
+ return marker.substr(p + 1);
+}
+
+RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(RGWRados *store,
+ const RGWBucketInfo& bucket_info,
+ int shard_id,
+ const std::string& start_marker,
+ const std::string& end_marker)
+ : RGWSimpleCoroutine(store->ctx()), bs(store),
+ start_marker(normalize_shard_marker(start_marker)),
+ end_marker(normalize_shard_marker(end_marker))
+{
+ bs.init(bucket_info, shard_id);
+}
+
+int RGWRadosBILogTrimCR::send_request()
+{
+ bufferlist in;
+ cls_rgw_bi_log_trim_op call;
+ call.start_marker = std::move(start_marker);
+ call.end_marker = std::move(end_marker);
+ ::encode(call, in);
+
+ librados::ObjectWriteOperation op;
+ op.exec(RGW_CLASS, RGW_BI_LOG_TRIM, in);
+
+ cn = stack->create_completion_notifier();
+ return bs.index_ctx.aio_operate(bs.bucket_obj, cn->completion(), &op);
+}
+
+int RGWRadosBILogTrimCR::request_complete()
+{
+ int r = cn->completion()->get_return_value();
+ set_status() << "request complete; ret=" << r;
+ return r;
+}
+
int RGWAsyncFetchRemoteObj::_send_request()
{
RGWObjectCtx obj_ctx(store);
}
};
+class RGWRadosBILogTrimCR : public RGWSimpleCoroutine {
+ RGWRados::BucketShard bs;
+ std::string start_marker;
+ std::string end_marker;
+ boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
+ public:
+ RGWRadosBILogTrimCR(RGWRados *store, const RGWBucketInfo& bucket_info,
+ int shard_id, const std::string& start_marker,
+ const std::string& end_marker);
+
+ int send_request() override;
+ int request_complete() override;
+};
+
class RGWAsyncFetchRemoteObj : public RGWAsyncRadosRequest {
RGWRados *store;
string source_zone;