mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
rgw: new cr for simple object put
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
parent
0fb443aa35
commit
3bd6661082
@ -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;
|
||||
}
|
||||
|
@ -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<rgw_bucket_create_local_params>;
|
||||
|
||||
struct rgw_object_simple_put_params {
|
||||
RGWDataAccess::BucketRef bucket;
|
||||
rgw_obj_key key;
|
||||
bufferlist data;
|
||||
map<string, bufferlist> attrs;
|
||||
};
|
||||
|
||||
using RGWObjectSimplePutCR = RGWSimpleWriteOnlyAsyncCR<rgw_object_simple_put_params>;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -234,6 +234,7 @@ class PSSubscription : public RefCountedObject {
|
||||
PSSubConfigRef sub_conf;
|
||||
shared_ptr<rgw_get_bucket_info_result> 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<RGWDataAccess>(sync_env->store)) {}
|
||||
|
||||
RGWCoroutine *init_cr() {
|
||||
return new InitCR(sync_env, this);
|
||||
|
@ -191,4 +191,6 @@ public:
|
||||
friend class Object;
|
||||
};
|
||||
|
||||
using RGWDataAccessRef = std::shared_ptr<RGWDataAccess>;
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user