1 #ifndef CEPH_RGW_CR_RADOS_H
2 #define CEPH_RGW_CR_RADOS_H
4 #include <boost/intrusive_ptr.hpp>
5 #include "include/assert.h"
6 #include "rgw_coroutine.h"
8 #include "common/WorkQueue.h"
9 #include "common/Throttle.h"
13 class RGWAsyncRadosRequest : public RefCountedObject {
15 RGWAioCompletionNotifier *notifier;
22 virtual int _send_request() = 0;
24 RGWAsyncRadosRequest(RGWCoroutine *_caller, RGWAioCompletionNotifier *_cn) : caller(_caller), notifier(_cn), retcode(0),
25 lock("RGWAsyncRadosRequest::lock") {
27 ~RGWAsyncRadosRequest() override {
35 retcode = _send_request();
37 Mutex::Locker l(lock);
39 notifier->cb(); // drops its own ref
46 int get_ret_status() { return retcode; }
50 Mutex::Locker l(lock);
52 // we won't call notifier->cb() to drop its ref, so drop it here
62 class RGWAsyncRadosProcessor {
63 deque<RGWAsyncRadosRequest *> m_req_queue;
64 std::atomic<bool> going_down = { false };
68 Throttle req_throttle;
70 struct RGWWQ : public ThreadPool::WorkQueue<RGWAsyncRadosRequest> {
71 RGWAsyncRadosProcessor *processor;
72 RGWWQ(RGWAsyncRadosProcessor *p, time_t timeout, time_t suicide_timeout, ThreadPool *tp)
73 : ThreadPool::WorkQueue<RGWAsyncRadosRequest>("RGWWQ", timeout, suicide_timeout, tp), processor(p) {}
75 bool _enqueue(RGWAsyncRadosRequest *req) override;
76 void _dequeue(RGWAsyncRadosRequest *req) override {
79 bool _empty() override;
80 RGWAsyncRadosRequest *_dequeue() override;
81 using ThreadPool::WorkQueue<RGWAsyncRadosRequest>::_process;
82 void _process(RGWAsyncRadosRequest *req, ThreadPool::TPHandle& handle) override;
84 void _clear() override {
85 assert(processor->m_req_queue.empty());
90 RGWAsyncRadosProcessor(RGWRados *_store, int num_threads);
91 ~RGWAsyncRadosProcessor() {}
94 void handle_request(RGWAsyncRadosRequest *req);
95 void queue(RGWAsyncRadosRequest *req);
97 bool is_going_down() {
103 class RGWAsyncGetSystemObj : public RGWAsyncRadosRequest {
105 RGWObjectCtx *obj_ctx;
106 RGWRados::SystemObject::Read::GetObjState read_state;
107 RGWObjVersionTracker *objv_tracker;
110 map<string, bufferlist> *pattrs;
114 int _send_request() override;
116 RGWAsyncGetSystemObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store, RGWObjectCtx *_obj_ctx,
117 RGWObjVersionTracker *_objv_tracker, const rgw_raw_obj& _obj,
118 bufferlist *_pbl, off_t _ofs, off_t _end);
119 void set_read_attrs(map<string, bufferlist> *_pattrs) { pattrs = _pattrs; }
122 class RGWAsyncPutSystemObj : public RGWAsyncRadosRequest {
124 RGWObjVersionTracker *objv_tracker;
130 int _send_request() override;
132 RGWAsyncPutSystemObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
133 RGWObjVersionTracker *_objv_tracker, rgw_raw_obj& _obj,
134 bool _exclusive, bufferlist& _bl);
137 class RGWAsyncPutSystemObjAttrs : public RGWAsyncRadosRequest {
139 RGWObjVersionTracker *objv_tracker;
141 map<string, bufferlist> *attrs;
144 int _send_request() override;
146 RGWAsyncPutSystemObjAttrs(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
147 RGWObjVersionTracker *_objv_tracker, const rgw_raw_obj& _obj,
148 map<string, bufferlist> *_attrs);
151 class RGWAsyncLockSystemObj : public RGWAsyncRadosRequest {
156 uint32_t duration_secs;
159 int _send_request() override;
161 RGWAsyncLockSystemObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
162 RGWObjVersionTracker *_objv_tracker, const rgw_raw_obj& _obj,
163 const string& _name, const string& _cookie, uint32_t _duration_secs);
166 class RGWAsyncUnlockSystemObj : public RGWAsyncRadosRequest {
173 int _send_request() override;
175 RGWAsyncUnlockSystemObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
176 RGWObjVersionTracker *_objv_tracker, const rgw_raw_obj& _obj,
177 const string& _name, const string& _cookie);
181 class RGWSimpleRadosReadCR : public RGWSimpleCoroutine {
182 RGWAsyncRadosProcessor *async_rados;
184 RGWObjectCtx obj_ctx;
189 map<string, bufferlist> *pattrs{nullptr};
192 /// on ENOENT, call handle_data() with an empty object instead of failing
193 const bool empty_on_enoent;
194 RGWObjVersionTracker *objv_tracker;
196 RGWAsyncGetSystemObj *req{nullptr};
199 RGWSimpleRadosReadCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
200 const rgw_raw_obj& _obj,
201 T *_result, bool empty_on_enoent = true,
202 RGWObjVersionTracker *objv_tracker = nullptr)
203 : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
204 obj_ctx(store), obj(_obj), result(_result),
205 empty_on_enoent(empty_on_enoent), objv_tracker(objv_tracker) {}
206 ~RGWSimpleRadosReadCR() override {
210 void request_cleanup() override {
217 int send_request() override;
218 int request_complete() override;
220 virtual int handle_data(T& data) {
226 int RGWSimpleRadosReadCR<T>::send_request()
228 req = new RGWAsyncGetSystemObj(this, stack->create_completion_notifier(),
229 store, &obj_ctx, objv_tracker,
233 req->set_read_attrs(pattrs);
235 async_rados->queue(req);
240 int RGWSimpleRadosReadCR<T>::request_complete()
242 int ret = req->get_ret_status();
244 if (ret == -ENOENT && empty_on_enoent) {
251 bufferlist::iterator iter = bl.begin();
253 // allow successful reads with empty buffers. ReadSyncStatus coroutines
254 // depend on this to be able to read without locking, because the
255 // cls lock from InitSyncStatus will create an empty object if it didnt
259 ::decode(*result, iter);
261 } catch (buffer::error& err) {
266 return handle_data(*result);
269 class RGWSimpleRadosReadAttrsCR : public RGWSimpleCoroutine {
270 RGWAsyncRadosProcessor *async_rados;
272 RGWObjectCtx obj_ctx;
277 map<string, bufferlist> *pattrs;
279 RGWAsyncGetSystemObj *req;
282 RGWSimpleRadosReadAttrsCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
283 const rgw_raw_obj& _obj,
284 map<string, bufferlist> *_pattrs) : RGWSimpleCoroutine(_store->ctx()),
285 async_rados(_async_rados), store(_store),
290 ~RGWSimpleRadosReadAttrsCR() override {
294 void request_cleanup() override {
301 int send_request() override;
302 int request_complete() override;
306 class RGWSimpleRadosWriteCR : public RGWSimpleCoroutine {
307 RGWAsyncRadosProcessor *async_rados;
312 RGWObjVersionTracker *objv_tracker;
314 RGWAsyncPutSystemObj *req{nullptr};
317 RGWSimpleRadosWriteCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
318 const rgw_raw_obj& _obj,
319 const T& _data, RGWObjVersionTracker *objv_tracker = nullptr)
320 : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados),
321 store(_store), obj(_obj), objv_tracker(objv_tracker) {
325 ~RGWSimpleRadosWriteCR() override {
329 void request_cleanup() override {
336 int send_request() override {
337 req = new RGWAsyncPutSystemObj(this, stack->create_completion_notifier(),
338 store, objv_tracker, obj, false, bl);
339 async_rados->queue(req);
343 int request_complete() override {
344 return req->get_ret_status();
348 class RGWSimpleRadosWriteAttrsCR : public RGWSimpleCoroutine {
349 RGWAsyncRadosProcessor *async_rados;
354 map<string, bufferlist> attrs;
356 RGWAsyncPutSystemObjAttrs *req;
359 RGWSimpleRadosWriteAttrsCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
360 const rgw_raw_obj& _obj,
361 map<string, bufferlist>& _attrs) : RGWSimpleCoroutine(_store->ctx()),
362 async_rados(_async_rados),
365 attrs(_attrs), req(NULL) {
367 ~RGWSimpleRadosWriteAttrsCR() override {
371 void request_cleanup() override {
378 int send_request() override {
379 req = new RGWAsyncPutSystemObjAttrs(this, stack->create_completion_notifier(),
380 store, NULL, obj, &attrs);
381 async_rados->queue(req);
385 int request_complete() override {
386 return req->get_ret_status();
390 class RGWRadosSetOmapKeysCR : public RGWSimpleCoroutine {
392 map<string, bufferlist> entries;
398 boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
401 RGWRadosSetOmapKeysCR(RGWRados *_store,
402 const rgw_raw_obj& _obj,
403 map<string, bufferlist>& _entries);
405 int send_request() override;
406 int request_complete() override;
409 class RGWRadosGetOmapKeysCR : public RGWSimpleCoroutine {
413 map<string, bufferlist> *entries;
421 boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
424 RGWRadosGetOmapKeysCR(RGWRados *_store,
425 const rgw_raw_obj& _obj,
426 const string& _marker,
427 map<string, bufferlist> *_entries, int _max_entries);
429 int send_request() override;
431 int request_complete() override {
436 class RGWRadosRemoveOmapKeysCR : public RGWSimpleCoroutine {
445 boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
448 RGWRadosRemoveOmapKeysCR(RGWRados *_store,
449 const rgw_raw_obj& _obj,
450 const set<string>& _keys);
452 int send_request() override;
454 int request_complete() override;
457 class RGWRadosRemoveCR : public RGWSimpleCoroutine {
459 librados::IoCtx ioctx;
460 const rgw_raw_obj obj;
461 boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
464 RGWRadosRemoveCR(RGWRados *store, const rgw_raw_obj& obj);
467 int request_complete();
470 class RGWSimpleRadosLockCR : public RGWSimpleCoroutine {
471 RGWAsyncRadosProcessor *async_rados;
479 RGWAsyncLockSystemObj *req;
482 RGWSimpleRadosLockCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
483 const rgw_raw_obj& _obj,
484 const string& _lock_name,
485 const string& _cookie,
487 ~RGWSimpleRadosLockCR() override {
490 void request_cleanup() override;
492 int send_request() override;
493 int request_complete() override;
495 static std::string gen_random_cookie(CephContext* cct) {
496 #define COOKIE_LEN 16
497 char buf[COOKIE_LEN + 1];
498 gen_rand_alphanumeric(cct, buf, sizeof(buf) - 1);
503 class RGWSimpleRadosUnlockCR : public RGWSimpleCoroutine {
504 RGWAsyncRadosProcessor *async_rados;
511 RGWAsyncUnlockSystemObj *req;
514 RGWSimpleRadosUnlockCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
515 const rgw_raw_obj& _obj,
516 const string& _lock_name,
517 const string& _cookie);
518 ~RGWSimpleRadosUnlockCR() override {
521 void request_cleanup() override;
523 int send_request() override;
524 int request_complete() override;
527 #define OMAP_APPEND_MAX_ENTRIES_DEFAULT 100
529 class RGWOmapAppend : public RGWConsumerCR<string> {
530 RGWAsyncRadosProcessor *async_rados;
537 int num_pending_entries;
538 list<string> pending_entries;
540 map<string, bufferlist> entries;
542 uint64_t window_size;
543 uint64_t total_entries;
545 RGWOmapAppend(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
546 const rgw_raw_obj& _obj,
547 uint64_t _window_size = OMAP_APPEND_MAX_ENTRIES_DEFAULT);
548 int operate() override;
549 void flush_pending();
550 bool append(const string& s);
553 uint64_t get_total_entries() {
554 return total_entries;
557 const rgw_raw_obj& get_obj() {
562 class RGWAsyncWait : public RGWAsyncRadosRequest {
568 int _send_request() override {
569 Mutex::Locker l(*lock);
570 return cond->WaitInterval(*lock, interval);
573 RGWAsyncWait(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, CephContext *_cct,
574 Mutex *_lock, Cond *_cond, int _secs) : RGWAsyncRadosRequest(caller, cn),
576 lock(_lock), cond(_cond), interval(_secs, 0) {}
579 Mutex::Locker l(*lock);
584 class RGWWaitCR : public RGWSimpleCoroutine {
586 RGWAsyncRadosProcessor *async_rados;
594 RGWWaitCR(RGWAsyncRadosProcessor *_async_rados, CephContext *_cct,
595 Mutex *_lock, Cond *_cond,
596 int _secs) : RGWSimpleCoroutine(_cct), cct(_cct),
597 async_rados(_async_rados), lock(_lock), cond(_cond), secs(_secs), req(NULL) {
599 ~RGWWaitCR() override {
603 void request_cleanup() override {
611 int send_request() override {
612 req = new RGWAsyncWait(this, stack->create_completion_notifier(), cct, lock, cond, secs);
613 async_rados->queue(req);
617 int request_complete() override {
618 return req->get_ret_status();
626 class RGWShardedOmapCRManager {
627 RGWAsyncRadosProcessor *async_rados;
633 vector<RGWOmapAppend *> shards;
635 RGWShardedOmapCRManager(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store, RGWCoroutine *_op, int _num_shards, const rgw_pool& pool, const string& oid_prefix)
636 : async_rados(_async_rados),
637 store(_store), op(_op), num_shards(_num_shards) {
638 shards.reserve(num_shards);
639 for (int i = 0; i < num_shards; ++i) {
640 char buf[oid_prefix.size() + 16];
641 snprintf(buf, sizeof(buf), "%s.%d", oid_prefix.c_str(), i);
642 RGWOmapAppend *shard = new RGWOmapAppend(async_rados, store, rgw_raw_obj(pool, buf));
644 shards.push_back(shard);
645 op->spawn(shard, false);
649 ~RGWShardedOmapCRManager() {
650 for (auto shard : shards) {
655 bool append(const string& entry, int shard_id) {
656 return shards[shard_id]->append(entry);
660 for (vector<RGWOmapAppend *>::iterator iter = shards.begin(); iter != shards.end(); ++iter) {
661 success &= ((*iter)->finish() && (!(*iter)->is_error()));
666 uint64_t get_total_entries(int shard_id) {
667 return shards[shard_id]->get_total_entries();
671 class RGWAsyncGetBucketInstanceInfo : public RGWAsyncRadosRequest {
674 RGWBucketInfo *bucket_info;
677 int _send_request() override;
679 RGWAsyncGetBucketInstanceInfo(RGWCoroutine *caller, RGWAioCompletionNotifier *cn,
680 RGWRados *_store, const rgw_bucket& bucket,
681 RGWBucketInfo *_bucket_info)
682 : RGWAsyncRadosRequest(caller, cn), store(_store),
683 bucket(bucket), bucket_info(_bucket_info) {}
686 class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine {
687 RGWAsyncRadosProcessor *async_rados;
690 RGWBucketInfo *bucket_info;
692 RGWAsyncGetBucketInstanceInfo *req;
695 RGWGetBucketInstanceInfoCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
696 const rgw_bucket& bucket, RGWBucketInfo *_bucket_info)
697 : RGWSimpleCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
698 bucket(bucket), bucket_info(_bucket_info), req(NULL) {}
699 ~RGWGetBucketInstanceInfoCR() override {
702 void request_cleanup() override {
709 int send_request() override {
710 req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, bucket, bucket_info);
711 async_rados->queue(req);
714 int request_complete() override {
715 return req->get_ret_status();
719 class RGWAsyncFetchRemoteObj : public RGWAsyncRadosRequest {
723 RGWBucketInfo bucket_info;
726 uint64_t versioned_epoch;
731 rgw_zone_set *zones_trace;
734 int _send_request() override;
736 RGWAsyncFetchRemoteObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
737 const string& _source_zone,
738 RGWBucketInfo& _bucket_info,
739 const rgw_obj_key& _key,
740 uint64_t _versioned_epoch,
741 bool _if_newer, rgw_zone_set *_zones_trace) : RGWAsyncRadosRequest(caller, cn), store(_store),
742 source_zone(_source_zone),
743 bucket_info(_bucket_info),
745 versioned_epoch(_versioned_epoch),
746 copy_if_newer(_if_newer), zones_trace(_zones_trace) {}
749 class RGWFetchRemoteObjCR : public RGWSimpleCoroutine {
751 RGWAsyncRadosProcessor *async_rados;
755 RGWBucketInfo bucket_info;
758 uint64_t versioned_epoch;
764 RGWAsyncFetchRemoteObj *req;
765 rgw_zone_set *zones_trace;
768 RGWFetchRemoteObjCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
769 const string& _source_zone,
770 RGWBucketInfo& _bucket_info,
771 const rgw_obj_key& _key,
772 uint64_t _versioned_epoch,
773 bool _if_newer, rgw_zone_set *_zones_trace) : RGWSimpleCoroutine(_store->ctx()), cct(_store->ctx()),
774 async_rados(_async_rados), store(_store),
775 source_zone(_source_zone),
776 bucket_info(_bucket_info),
778 versioned_epoch(_versioned_epoch),
779 copy_if_newer(_if_newer), req(NULL), zones_trace(_zones_trace) {}
782 ~RGWFetchRemoteObjCR() override {
786 void request_cleanup() override {
793 int send_request() override {
794 req = new RGWAsyncFetchRemoteObj(this, stack->create_completion_notifier(), store, source_zone, bucket_info,
795 key, versioned_epoch, copy_if_newer, zones_trace);
796 async_rados->queue(req);
800 int request_complete() override {
801 return req->get_ret_status();
805 class RGWAsyncStatRemoteObj : public RGWAsyncRadosRequest {
809 RGWBucketInfo bucket_info;
813 ceph::real_time *pmtime;
815 map<string, bufferlist> *pattrs;
818 int _send_request() override;
820 RGWAsyncStatRemoteObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
821 const string& _source_zone,
822 RGWBucketInfo& _bucket_info,
823 const rgw_obj_key& _key,
824 ceph::real_time *_pmtime,
826 map<string, bufferlist> *_pattrs) : RGWAsyncRadosRequest(caller, cn), store(_store),
827 source_zone(_source_zone),
828 bucket_info(_bucket_info),
835 class RGWStatRemoteObjCR : public RGWSimpleCoroutine {
837 RGWAsyncRadosProcessor *async_rados;
841 RGWBucketInfo bucket_info;
845 ceph::real_time *pmtime;
847 map<string, bufferlist> *pattrs;
849 RGWAsyncStatRemoteObj *req;
852 RGWStatRemoteObjCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
853 const string& _source_zone,
854 RGWBucketInfo& _bucket_info,
855 const rgw_obj_key& _key,
856 ceph::real_time *_pmtime,
858 map<string, bufferlist> *_pattrs) : RGWSimpleCoroutine(_store->ctx()), cct(_store->ctx()),
859 async_rados(_async_rados), store(_store),
860 source_zone(_source_zone),
861 bucket_info(_bucket_info),
869 ~RGWStatRemoteObjCR() override {
873 void request_cleanup() override {
880 int send_request() override {
881 req = new RGWAsyncStatRemoteObj(this, stack->create_completion_notifier(), store, source_zone,
882 bucket_info, key, pmtime, psize, pattrs);
883 async_rados->queue(req);
887 int request_complete() override {
888 return req->get_ret_status();
892 class RGWAsyncRemoveObj : public RGWAsyncRadosRequest {
896 RGWBucketInfo bucket_info;
900 string owner_display_name;
902 uint64_t versioned_epoch;
903 string marker_version_id;
906 ceph::real_time timestamp;
907 rgw_zone_set *zones_trace;
910 int _send_request() override;
912 RGWAsyncRemoveObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *_store,
913 const string& _source_zone,
914 RGWBucketInfo& _bucket_info,
915 const rgw_obj_key& _key,
916 const string& _owner,
917 const string& _owner_display_name,
919 uint64_t _versioned_epoch,
922 real_time& _timestamp,
923 rgw_zone_set* _zones_trace) : RGWAsyncRadosRequest(caller, cn), store(_store),
924 source_zone(_source_zone),
925 bucket_info(_bucket_info),
928 owner_display_name(_owner_display_name),
929 versioned(_versioned),
930 versioned_epoch(_versioned_epoch),
931 del_if_older(_if_older),
932 timestamp(_timestamp), zones_trace(_zones_trace) {
933 if (_delete_marker) {
934 marker_version_id = key.instance;
939 class RGWRemoveObjCR : public RGWSimpleCoroutine {
941 RGWAsyncRadosProcessor *async_rados;
945 RGWBucketInfo bucket_info;
949 uint64_t versioned_epoch;
952 string owner_display_name;
957 RGWAsyncRemoveObj *req;
959 rgw_zone_set *zones_trace;
962 RGWRemoveObjCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
963 const string& _source_zone,
964 RGWBucketInfo& _bucket_info,
965 const rgw_obj_key& _key,
967 uint64_t _versioned_epoch,
969 string *_owner_display_name,
971 real_time *_timestamp,
972 rgw_zone_set *_zones_trace) : RGWSimpleCoroutine(_store->ctx()), cct(_store->ctx()),
973 async_rados(_async_rados), store(_store),
974 source_zone(_source_zone),
975 bucket_info(_bucket_info),
977 versioned(_versioned),
978 versioned_epoch(_versioned_epoch),
979 delete_marker(_delete_marker), req(NULL), zones_trace(_zones_trace) {
980 del_if_older = (_timestamp != NULL);
982 timestamp = *_timestamp;
989 if (_owner_display_name) {
990 owner_display_name = *_owner_display_name;
993 ~RGWRemoveObjCR() override {
997 void request_cleanup() override {
1004 int send_request() override {
1005 req = new RGWAsyncRemoveObj(this, stack->create_completion_notifier(), store, source_zone, bucket_info,
1006 key, owner, owner_display_name, versioned, versioned_epoch,
1007 delete_marker, del_if_older, timestamp, zones_trace);
1008 async_rados->queue(req);
1012 int request_complete() override {
1013 return req->get_ret_status();
1017 class RGWContinuousLeaseCR : public RGWCoroutine {
1018 RGWAsyncRadosProcessor *async_rados;
1021 const rgw_raw_obj obj;
1023 const string lock_name;
1024 const string cookie;
1029 std::atomic<bool> going_down = { false };
1032 RGWCoroutine *caller;
1034 bool aborted{false};
1037 RGWContinuousLeaseCR(RGWAsyncRadosProcessor *_async_rados, RGWRados *_store,
1038 const rgw_raw_obj& _obj,
1039 const string& _lock_name, int _interval, RGWCoroutine *_caller)
1040 : RGWCoroutine(_store->ctx()), async_rados(_async_rados), store(_store),
1041 obj(_obj), lock_name(_lock_name),
1042 cookie(RGWSimpleRadosLockCR::gen_random_cookie(cct)),
1043 interval(_interval), lock("RGWContinuousLeaseCR"), caller(_caller)
1046 int operate() override;
1049 Mutex::Locker l(lock);
1053 void set_locked(bool status) {
1054 Mutex::Locker l(lock);
1068 class RGWRadosTimelogAddCR : public RGWSimpleCoroutine {
1070 list<cls_log_entry> entries;
1074 boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
1077 RGWRadosTimelogAddCR(RGWRados *_store, const string& _oid,
1078 const cls_log_entry& entry);
1080 int send_request() override;
1081 int request_complete() override;
1084 class RGWRadosTimelogTrimCR : public RGWSimpleCoroutine {
1086 boost::intrusive_ptr<RGWAioCompletionNotifier> cn;
1089 real_time start_time;
1091 std::string from_marker;
1092 std::string to_marker;
1095 RGWRadosTimelogTrimCR(RGWRados *store, const std::string& oid,
1096 const real_time& start_time, const real_time& end_time,
1097 const std::string& from_marker,
1098 const std::string& to_marker);
1100 int send_request() override;
1101 int request_complete() override;
1104 // wrapper to update last_trim_marker on success
1105 class RGWSyncLogTrimCR : public RGWRadosTimelogTrimCR {
1107 std::string *last_trim_marker;
1109 RGWSyncLogTrimCR(RGWRados *store, const std::string& oid,
1110 const std::string& to_marker, std::string *last_trim_marker);
1111 int request_complete() override;
1114 class RGWAsyncStatObj : public RGWAsyncRadosRequest {
1116 RGWBucketInfo bucket_info;
1121 RGWObjVersionTracker *objv_tracker;
1123 int _send_request() override;
1125 RGWAsyncStatObj(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWRados *store,
1126 const RGWBucketInfo& _bucket_info, const rgw_obj& obj, uint64_t *psize = nullptr,
1127 real_time *pmtime = nullptr, uint64_t *pepoch = nullptr,
1128 RGWObjVersionTracker *objv_tracker = nullptr)
1129 : RGWAsyncRadosRequest(caller, cn), store(store), obj(obj), psize(psize),
1130 pmtime(pmtime), pepoch(pepoch), objv_tracker(objv_tracker) {}
1133 class RGWStatObjCR : public RGWSimpleCoroutine {
1135 RGWAsyncRadosProcessor *async_rados;
1136 RGWBucketInfo bucket_info;
1141 RGWObjVersionTracker *objv_tracker;
1142 RGWAsyncStatObj *req = nullptr;
1144 RGWStatObjCR(RGWAsyncRadosProcessor *async_rados, RGWRados *store,
1145 const RGWBucketInfo& _bucket_info, const rgw_obj& obj, uint64_t *psize = nullptr,
1146 real_time* pmtime = nullptr, uint64_t *pepoch = nullptr,
1147 RGWObjVersionTracker *objv_tracker = nullptr);
1148 ~RGWStatObjCR() override {
1151 void request_cleanup() override;
1153 int send_request() override;
1154 int request_complete() override;