}
};
-class RGWAsyncWait : public RGWAsyncRadosRequest {
- CephContext *cct;
- ceph::mutex *lock;
- ceph::condition_variable *cond;
- std::chrono::seconds interval;
-protected:
- int _send_request() override {
- std::unique_lock l{*lock};
- return (cond->wait_for(l, interval) == std::cv_status::timeout ?
- ETIMEDOUT : 0);
- }
-public:
- RGWAsyncWait(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, CephContext *_cct,
- ceph::mutex *_lock, ceph::condition_variable *_cond, int _secs)
- : RGWAsyncRadosRequest(caller, cn),
- cct(_cct),
- lock(_lock), cond(_cond), interval(_secs) {}
-
- void wakeup() {
- std::lock_guard l{*lock};
- cond->notify_all();
- }
-};
-
-class RGWWaitCR : public RGWSimpleCoroutine {
- CephContext *cct;
- RGWAsyncRadosProcessor *async_rados;
- ceph::mutex *lock;
- ceph::condition_variable *cond;
- int secs;
-
- RGWAsyncWait *req;
-
-public:
- RGWWaitCR(RGWAsyncRadosProcessor *_async_rados, CephContext *_cct,
- ceph::mutex *_lock, ceph::condition_variable *_cond,
- int _secs) : RGWSimpleCoroutine(_cct), cct(_cct),
- async_rados(_async_rados), lock(_lock), cond(_cond), secs(_secs), req(NULL) {
- }
- ~RGWWaitCR() override {
- request_cleanup();
- }
-
- void request_cleanup() override {
- if (req) {
- wakeup();
- req->finish();
- req = NULL;
- }
- }
-
- int send_request() override {
- req = new RGWAsyncWait(this, stack->create_completion_notifier(), cct, lock, cond, secs);
- async_rados->queue(req);
- return 0;
- }
-
- int request_complete() override {
- return req->get_ret_status();
- }
-
- void wakeup() {
- req->wakeup();
- }
-};
-
class RGWShardedOmapCRManager {
RGWAsyncRadosProcessor *async_rados;
rgw::sal::RGWRadosStore *store;