From 73a21475d6c883b1618817b25f0e588e20f7f2a2 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 14 Sep 2015 17:09:58 -0700 Subject: [PATCH] rgw: move more code Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_cr_rados.h | 57 ++++++++++++++++++++++++++++++++++++++++++ src/rgw/rgw_sync.cc | 57 ------------------------------------------ 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index ab1844da61c62..8d133dfa5e576 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -349,4 +349,61 @@ public: void finish(); }; +class RGWAsyncWait : public RGWAsyncRadosRequest { + CephContext *cct; + Mutex *lock; + Cond *cond; + utime_t interval; +protected: + int _send_request() { + Mutex::Locker l(*lock); + return cond->WaitInterval(cct, *lock, interval); + } +public: + RGWAsyncWait(RGWAioCompletionNotifier *cn, CephContext *_cct, Mutex *_lock, Cond *_cond, int _secs) : RGWAsyncRadosRequest(cn), + cct(_cct), + lock(_lock), cond(_cond), interval(_secs, 0) {} + + void wakeup() { + Mutex::Locker l(*lock); + cond->Signal(); + } +}; + +class RGWWaitCR : public RGWSimpleCoroutine { + CephContext *cct; + RGWAsyncRadosProcessor *async_rados; + Mutex *lock; + Cond *cond; + int secs; + + RGWAsyncWait *req; + +public: + RGWWaitCR(RGWAsyncRadosProcessor *_async_rados, CephContext *_cct, + Mutex *_lock, Cond *_cond, + int _secs) : RGWSimpleCoroutine(cct), cct(_cct), + async_rados(_async_rados), lock(_lock), cond(_cond), secs(_secs) { + } + + ~RGWWaitCR() { + wakeup(); + delete req; + } + + int send_request() { + req = new RGWAsyncWait(stack->create_completion_notifier(), cct, lock, cond, secs); + async_rados->queue(req); + return 0; + } + + int request_complete() { + return req->get_ret_status(); + } + + void wakeup() { + req->wakeup(); + } +}; + #endif diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index eb72eecb42eb9..c849248e0eabb 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -259,63 +259,6 @@ public: } }; -class RGWAsyncWait : public RGWAsyncRadosRequest { - CephContext *cct; - Mutex *lock; - Cond *cond; - utime_t interval; -protected: - int _send_request() { - Mutex::Locker l(*lock); - return cond->WaitInterval(cct, *lock, interval); - } -public: - RGWAsyncWait(RGWAioCompletionNotifier *cn, CephContext *_cct, Mutex *_lock, Cond *_cond, int _secs) : RGWAsyncRadosRequest(cn), - cct(_cct), - lock(_lock), cond(_cond), interval(_secs, 0) {} - - void wakeup() { - Mutex::Locker l(*lock); - cond->Signal(); - } -}; - -class RGWWaitCR : public RGWSimpleCoroutine { - CephContext *cct; - RGWAsyncRadosProcessor *async_rados; - Mutex *lock; - Cond *cond; - int secs; - - RGWAsyncWait *req; - -public: - RGWWaitCR(RGWAsyncRadosProcessor *_async_rados, CephContext *_cct, - Mutex *_lock, Cond *_cond, - int _secs) : RGWSimpleCoroutine(cct), cct(_cct), - async_rados(_async_rados), lock(_lock), cond(_cond), secs(_secs) { - } - - ~RGWWaitCR() { - wakeup(); - delete req; - } - - int send_request() { - req = new RGWAsyncWait(stack->create_completion_notifier(), cct, lock, cond, secs); - async_rados->queue(req); - return 0; - } - - int request_complete() { - return req->get_ret_status(); - } - - void wakeup() { - req->wakeup(); - } -}; - class RGWAsyncReadMDLogEntries : public RGWAsyncRadosRequest { RGWRados *store; RGWMetadataLog *mdlog; -- 2.39.5