diff --git a/src/rgw/rgw_cr_tools.cc b/src/rgw/rgw_cr_tools.cc index d7dbc6d7bb9..69eed3689b2 100644 --- a/src/rgw/rgw_cr_tools.cc +++ b/src/rgw/rgw_cr_tools.cc @@ -222,3 +222,22 @@ int RGWBucketCreateLocalCR::Request::_send_request() return ret; } + +template<> +int RGWObjectSimplePutCR::Request::_send_request() +{ + RGWDataAccess::ObjectRef obj; + + int ret = params.bucket->get_object(params.key, &obj); + if (ret < 0) { + cerr << "ERROR: failed to get object: " << cpp_strerror(-ret) << std::endl; + return -ret; + } + + ret = obj->put(params.data, params.attrs); + if (ret < 0) { + cerr << "ERROR: put object returned error: " << cpp_strerror(-ret) << std::endl; + } + + return 0; +} diff --git a/src/rgw/rgw_cr_tools.h b/src/rgw/rgw_cr_tools.h index ab69d4c0e04..635bbb9302f 100644 --- a/src/rgw/rgw_cr_tools.h +++ b/src/rgw/rgw_cr_tools.h @@ -2,6 +2,7 @@ #define CEPH_RGW_CR_TOOLS_H #include "rgw_cr_rados.h" +#include "rgw_tools.h" struct rgw_user_create_params { @@ -50,6 +51,15 @@ struct rgw_bucket_create_local_params { using RGWBucketCreateLocalCR = RGWSimpleWriteOnlyAsyncCR; +struct rgw_object_simple_put_params { + RGWDataAccess::BucketRef bucket; + rgw_obj_key key; + bufferlist data; + map attrs; +}; + +using RGWObjectSimplePutCR = RGWSimpleWriteOnlyAsyncCR; + #endif diff --git a/src/rgw/rgw_sync_module_pubsub.cc b/src/rgw/rgw_sync_module_pubsub.cc index abcf83a894c..725d098e667 100644 --- a/src/rgw/rgw_sync_module_pubsub.cc +++ b/src/rgw/rgw_sync_module_pubsub.cc @@ -234,6 +234,7 @@ class PSSubscription : public RefCountedObject { PSSubConfigRef sub_conf; shared_ptr get_bucket_info_result; RGWBucketInfo *bucket_info{nullptr}; + RGWDataAccessRef data_access; public: @@ -304,7 +305,8 @@ public: PSEnvRef _env, PSSubConfigRef& _sub_conf) : sync_env(_sync_env), env(_env), - sub_conf(_sub_conf) {} + sub_conf(_sub_conf), + data_access(std::make_shared(sync_env->store)) {} RGWCoroutine *init_cr() { return new InitCR(sync_env, this); diff --git a/src/rgw/rgw_tools.h b/src/rgw/rgw_tools.h index 89a6aeaa7ef..0741eb6fa69 100644 --- a/src/rgw/rgw_tools.h +++ b/src/rgw/rgw_tools.h @@ -191,4 +191,6 @@ public: friend class Object; }; +using RGWDataAccessRef = std::shared_ptr; + #endif