From: Yehuda Sadeh Date: Thu, 12 May 2016 16:14:29 +0000 (-0700) Subject: rgw: add a cr for omap keys removal X-Git-Tag: v11.0.0~361^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=20c1b4b8a3695b818c5c64d61d5ea4f84c48c782;p=ceph.git rgw: add a cr for omap keys removal Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index e812347121d9..1f926fa925e5 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -289,6 +289,37 @@ int RGWRadosGetOmapKeysCR::send_request() { return ioctx.aio_operate(oid, cn->completion(), &op, NULL); } +RGWRadosRemoveOmapKeysCR::RGWRadosRemoveOmapKeysCR(RGWRados *_store, + const rgw_bucket& _pool, const string& _oid, + const set& _keys) : RGWSimpleCoroutine(_store->ctx()), + store(_store), + keys(_keys), + pool(_pool), oid(_oid), cn(NULL) +{ + set_description() << "remove omap keys dest=" << pool.name << "/" << oid << " keys=" << keys; +} + +RGWRadosRemoveOmapKeysCR::~RGWRadosRemoveOmapKeysCR() +{ +} + +int RGWRadosRemoveOmapKeysCR::send_request() { + librados::Rados *rados = store->get_rados_handle(); + int r = rados->ioctx_create(pool.name.c_str(), ioctx); /* system object only! */ + if (r < 0) { + lderr(store->ctx()) << "ERROR: failed to open pool (" << pool.name << ") ret=" << r << dendl; + return r; + } + + set_status() << "send request"; + + librados::ObjectWriteOperation op; + op.omap_rm_keys(keys); + + cn = stack->create_completion_notifier(); + return ioctx.aio_operate(oid, cn->completion(), &op); +} + RGWSimpleRadosLockCR::RGWSimpleRadosLockCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, const rgw_bucket& _pool, const string& _oid, const string& _lock_name, const string& _cookie, diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index af0481ce9922..8d28b081ebfc 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -429,6 +429,37 @@ public: } }; +class RGWRadosRemoveOmapKeysCR : public RGWSimpleCoroutine { + RGWRados *store; + + string marker; + map *entries; + int max_entries; + + int rval; + librados::IoCtx ioctx; + + set keys; + + rgw_bucket pool; + string oid; + + RGWAioCompletionNotifier *cn; + +public: + RGWRadosRemoveOmapKeysCR(RGWRados *_store, + const rgw_bucket& _pool, const string& _oid, + const set& _keys); + + ~RGWRadosRemoveOmapKeysCR(); + + int send_request(); + + int request_complete() { + return rval; + } +}; + class RGWSimpleRadosLockCR : public RGWSimpleCoroutine { RGWAsyncRadosProcessor *async_rados; RGWRados *store;