rgw: Add RGWAsyncPutBucketInstanceInfoCR

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
This commit is contained in:
Adam C. Emerson 2021-05-18 17:56:27 -04:00 committed by Casey Bodley
parent 485fa04fe8
commit da525470fb
2 changed files with 83 additions and 1 deletions

View File

@ -604,6 +604,19 @@ int RGWAsyncGetBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp)
return 0;
}
int RGWAsyncPutBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp)
{
auto r = store->getRados()->put_bucket_instance_info(bucket_info, exclusive,
mtime, attrs, dpp);
if (r < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to put bucket instance info for "
<< bucket_info.bucket << dendl;
return r;
}
return 0;
}
RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(
const DoutPrefixProvider *dpp,
rgw::sal::RadosStore* store,

View File

@ -878,6 +878,29 @@ public:
std::map<std::string, bufferlist> attrs;
};
class RGWAsyncPutBucketInstanceInfo : public RGWAsyncRadosRequest {
rgw::sal::RadosStore* store;
RGWBucketInfo& bucket_info;
bool exclusive;
real_time mtime;
std::map<std::string, ceph::bufferlist>* attrs;
const DoutPrefixProvider *dpp;
protected:
int _send_request(const DoutPrefixProvider *dpp) override;
public:
RGWAsyncPutBucketInstanceInfo(RGWCoroutine* caller,
RGWAioCompletionNotifier* cn,
rgw::sal::RadosStore* store,
RGWBucketInfo& bucket_info,
bool exclusive,
real_time mtime,
std::map<std::string, ceph::bufferlist>* attrs,
const DoutPrefixProvider* dpp)
: RGWAsyncRadosRequest(caller, cn), store(store), bucket_info(bucket_info),
exclusive(exclusive), mtime(mtime), attrs(attrs), dpp(dpp) {}
};
class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine {
RGWAsyncRadosProcessor *async_rados;
rgw::sal::RadosStore* store;
@ -887,7 +910,7 @@ class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine {
const DoutPrefixProvider *dpp;
RGWAsyncGetBucketInstanceInfo *req{nullptr};
public:
// rgw_bucket constructor
RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, rgw::sal::RadosStore* _store,
@ -921,6 +944,52 @@ public:
}
};
class RGWPutBucketInstanceInfoCR : public RGWSimpleCoroutine {
RGWAsyncRadosProcessor *async_rados;
rgw::sal::RadosStore* store;
RGWBucketInfo& bucket_info;
bool exclusive;
real_time mtime;
std::map<std::string, ceph::bufferlist>* attrs;
const DoutPrefixProvider *dpp;
RGWAsyncPutBucketInstanceInfo* req = nullptr;
public:
// rgw_bucket constructor
RGWPutBucketInstanceInfoCR(RGWAsyncRadosProcessor *async_rados,
rgw::sal::RadosStore* store,
RGWBucketInfo& bucket_info,
bool exclusive,
real_time mtime,
std::map<std::string, ceph::bufferlist>* attrs,
const DoutPrefixProvider *dpp)
: RGWSimpleCoroutine(store->ctx()), async_rados(async_rados), store(store),
bucket_info(bucket_info), exclusive(exclusive),
mtime(mtime), attrs(attrs), dpp(dpp) {}
~RGWPutBucketInstanceInfoCR() override {
request_cleanup();
}
void request_cleanup() override {
if (req) {
req->finish();
req = nullptr;
}
}
int send_request(const DoutPrefixProvider *dpp) override {
req = new RGWAsyncPutBucketInstanceInfo(this,
stack->create_completion_notifier(),
store, bucket_info, exclusive,
mtime, attrs, dpp);
async_rados->queue(req);
return 0;
}
int request_complete() override {
return req->get_ret_status();
}
};
class RGWRadosBILogTrimCR : public RGWSimpleCoroutine {
const RGWBucketInfo& bucket_info;
int shard_id;