From: Yehuda Sadeh Date: Fri, 15 Jan 2016 19:50:39 +0000 (-0800) Subject: rgw: add a timelog add operation cr X-Git-Tag: v10.1.0~354^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=744f3844fa6ae0084824441e08a6de04b669cdbb;p=ceph.git rgw: add a timelog add operation cr Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 83b472cd780..761acfee5aa 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -218,7 +218,9 @@ RGWRadosSetOmapKeysCR::RGWRadosSetOmapKeysCR(RGWRados *_store, RGWRadosSetOmapKeysCR::~RGWRadosSetOmapKeysCR() { - cn->put(); + if (cn) { + cn->put(); + } } int RGWRadosSetOmapKeysCR::send_request() @@ -573,3 +575,38 @@ int RGWContinuousLeaseCR::operate() } return 0; } + +RGWRadosTimelogAddCR::RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid, + const cls_log_entry& entry) : RGWSimpleCoroutine(_store->ctx()), + store(_store), + oid(_oid), cn(NULL) +{ + stringstream& s = set_description(); + s << "timelog add entry oid=" << oid << "entry={id=" << entry.id << ", section=" << entry.section << ", name=" << entry.name << "}"; + entries.push_back(entry); +} + +RGWRadosTimelogAddCR::~RGWRadosTimelogAddCR() +{ + if (cn) { + cn->put(); + } +} + +int RGWRadosTimelogAddCR::send_request() +{ + set_status() << "sending request"; + + cn = stack->create_completion_notifier(); + cn->get(); + return store->time_log_add(oid, entries, cn->completion(), true); +} + +int RGWRadosTimelogAddCR::request_complete() +{ + int r = cn->completion()->get_return_value(); + + set_status() << "request complete; ret=" << r; + + return r; +} diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 6f6c47438a4..52722578aff 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -869,5 +869,22 @@ public: } }; +class RGWRadosTimelogAddCR : public RGWSimpleCoroutine { + RGWRados *store; + list entries; + + string oid; + + RGWAioCompletionNotifier *cn; + +public: + RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid, + const cls_log_entry& entry); + ~RGWRadosTimelogAddCR(); + + int send_request(); + int request_complete(); +}; + #endif