]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_lib.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rgw / rgw_lib.h
index 0ddaa54e38f759fcfc6a8a373f77654dfebff0e3..9afd8d13272df20a006178d8192b2e1e14feba73 100644 (file)
@@ -1,5 +1,6 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
+
 #ifndef RGW_LIB_H
 #define RGW_LIB_H
 
@@ -14,7 +15,8 @@
 #include "rgw_process.h"
 #include "rgw_rest_s3.h" // RGW_Auth_S3
 #include "rgw_ldap.h"
-#include "include/assert.h"
+#include "services/svc_zone_utils.h"
+#include "include/ceph_assert.h"
 
 class OpsLogSocket;
 
@@ -60,10 +62,13 @@ namespace rgw {
     RGWLibIO() {
       get_env().set("HTTP_HOST", "");
     }
-    RGWLibIO(const RGWUserInfo &_user_info)
+    explicit RGWLibIO(const RGWUserInfo &_user_info)
       : user_info(_user_info) {}
 
-    void init_env(CephContext *cct) override {}
+    int init_env(CephContext *cct) override {
+      env.init(cct);
+      return 0;
+    }
 
     const RGWUserInfo& get_user() {
       return user_info;
@@ -112,7 +117,7 @@ namespace rgw {
     friend class RGWRESTMgr_Lib;
   public:
 
-    int authorize() override;
+    int authorize(const DoutPrefixProvider *dpp) override;
 
     RGWHandler_Lib() {}
     ~RGWHandler_Lib() override {}
@@ -124,12 +129,14 @@ namespace rgw {
   public:
     CephContext* cct;
     RGWUserInfo* user;
+    boost::optional<RGWSysObjectCtx> sysobj_ctx;
 
     /* unambiguiously return req_state */
     inline struct req_state* get_state() { return this->RGWRequest::s; }
 
     RGWLibRequest(CephContext* _cct, RGWUserInfo* _user)
-      :  RGWRequest(0), cct(_cct), user(_user)
+      :  RGWRequest(rgwlib.get_store()->get_new_req_id()), cct(_cct),
+        user(_user)
       {}
 
     RGWUserInfo* get_user() { return user; }
@@ -152,19 +159,17 @@ namespace rgw {
             RGWLibIO* io, struct req_state* _s) {
 
       RGWRequest::init_state(_s);
-      RGWHandler::init(rados_ctx->store, _s, io);
+      RGWHandler::init(rados_ctx->get_store(), _s, io);
 
-      /* fixup _s->req */
-      _s->req = this;
-
-      log_init();
+      sysobj_ctx.emplace(store->svc.sysobj);
 
       get_state()->obj_ctx = rados_ctx;
-      get_state()->req_id = store->unique_id(id);
-      get_state()->trans_id = store->unique_trans_id(id);
+      get_state()->sysobj_ctx = &(sysobj_ctx.get());
+      get_state()->req_id = store->svc.zone_utils->unique_id(id);
+      get_state()->trans_id = store->svc.zone_utils->unique_trans_id(id);
 
-      log_format(_s, "initializing for trans_id = %s",
-                get_state()->trans_id.c_str());
+      ldpp_dout(_s, 2) << "initializing for trans_id = "
+         << get_state()->trans_id.c_str() << dendl;
 
       int ret = header_init();
       if (ret == 0) {
@@ -187,30 +192,28 @@ namespace rgw {
 
     RGWLibContinuedReq(CephContext* _cct, RGWUserInfo* _user)
       :  RGWLibRequest(_cct, _user), io_ctx(),
-        rstate(_cct, &io_ctx.get_env(), _user), rados_ctx(rgwlib.get_store(),
-                                                          &rstate)
+        rstate(_cct, &io_ctx.get_env(), _user, id),
+        rados_ctx(rgwlib.get_store(), &rstate)
       {
        io_ctx.init(_cct);
 
        RGWRequest::init_state(&rstate);
-       RGWHandler::init(rados_ctx.store, &rstate, &io_ctx);
-
-       /* fixup _s->req */
-       get_state()->req = this;
+       RGWHandler::init(rados_ctx.get_store(), &rstate, &io_ctx);
 
-       log_init();
+       sysobj_ctx.emplace(store->svc.sysobj);
 
        get_state()->obj_ctx = &rados_ctx;
-       get_state()->req_id = store->unique_id(id);
-       get_state()->trans_id = store->unique_trans_id(id);
+       get_state()->sysobj_ctx = &(sysobj_ctx.get());
+       get_state()->req_id = store->svc.zone_utils->unique_id(id);
+       get_state()->trans_id = store->svc.zone_utils->unique_trans_id(id);
 
-       log_format(get_state(), "initializing for trans_id = %s",
-                  get_state()->trans_id.c_str());
+       ldpp_dout(get_state(), 2) << "initializing for trans_id = "
+           << get_state()->trans_id.c_str() << dendl;
       }
 
     inline RGWRados* get_store() { return store; }
 
-    virtual int execute() final { abort(); }
+    virtual int execute() final { ceph_abort(); }
     virtual int exec_start() = 0;
     virtual int exec_continue() = 0;
     virtual int exec_finish() = 0;