]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: process_request() takes RGWProcessEnv
authorCasey Bodley <cbodley@redhat.com>
Wed, 2 Nov 2022 17:56:51 +0000 (13:56 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 9 Dec 2022 21:40:32 +0000 (16:40 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_asio_frontend.cc
src/rgw/rgw_loadgen_process.cc
src/rgw/rgw_process.cc
src/rgw/rgw_process.h

index 659816b654fb531c8335a3c79eaafb0de65f6614..71d145ed565522ebd65feb382c64787d315b8f81 100644 (file)
@@ -270,13 +270,8 @@ void handle_connection(boost::asio::io_context& context,
       string user = "-";
       const auto started = ceph::coarse_real_clock::now();
       ceph::coarse_real_clock::duration latency{};
-      process_request(env.driver, env.rest, &req, uri_prefix,
-                      *env.auth_registry, &client, env.olog, y,
-                      scheduler, &user, &latency,
-                      env.ratelimiting->get_active(),
-                      env.lua_background,
-                      env.lua_manager,
-                      &http_ret);
+      process_request(env, &req, uri_prefix, &client, y,
+                      scheduler, &user, &latency, &http_ret);
 
       if (cct->_conf->subsys.should_gather(ceph_subsys_rgw_access, 1)) {
         // access log line elements begin per Apache Combined Log Format with additions following
index c4467cb31467ea7b859042d16cf2dd1d80caed6f..f8165185db30a5046919027064aa18430056f8fc 100644 (file)
@@ -132,13 +132,8 @@ void RGWLoadGenProcess::handle_request(const DoutPrefixProvider *dpp, RGWRequest
 
   RGWLoadGenIO real_client_io(&renv);
   RGWRestfulIO client_io(cct, &real_client_io);
-  ActiveRateLimiter ratelimit(cct);
-  int ret = process_request(env.driver, env.rest, req, uri_prefix,
-                            *env.auth_registry, &client_io, env.olog,
-                            null_yield, nullptr, nullptr, nullptr,
-                            ratelimit.get_active(),
-                            nullptr,
-                            env.lua_manager);
+  int ret = process_request(env, req, uri_prefix, &client_io,
+                            null_yield, nullptr, nullptr, nullptr);
   if (ret < 0) {
     /* we don't really care about return code */
     dout(20) << "process_request() returned " << ret << dendl;
index ffa9bd3354b8c10a056d3ca1a283c8e26562dd3e..e7164243c83d7bcd7949947c267be585a0e52017 100644 (file)
@@ -261,20 +261,14 @@ int rgw_process_authenticated(RGWHandler_REST * const handler,
   return 0;
 }
 
-int process_request(rgw::sal::Driver* const driver,
-                    RGWREST* const rest,
+int process_request(const RGWProcessEnv& penv,
                     RGWRequest* const req,
                     const std::string& frontend_prefix,
-                    const rgw_auth_registry_t& auth_registry,
                     RGWRestfulIO* const client_io,
-                    OpsLogSink* const olog,
                     optional_yield yield,
                    rgw::dmclock::Scheduler *scheduler,
                     string* user,
                     ceph::coarse_real_clock::duration* latency,
-                    std::shared_ptr<RateLimiter> ratelimit,
-                    rgw::lua::Background* lua_background,
-                    std::unique_ptr<rgw::sal::LuaManager>& lua_manager,
                     int* http_ret)
 {
   int ret = client_io->init(g_ceph_context);
@@ -287,7 +281,9 @@ int process_request(rgw::sal::Driver* const driver,
   req_state rstate(g_ceph_context, &rgw_env, req->id);
   req_state *s = &rstate;
 
-  s->ratelimit_data = ratelimit;
+  s->ratelimit_data = penv.ratelimiting->get_active();
+
+  rgw::sal::Driver* driver = penv.driver;
   std::unique_ptr<rgw::sal::User> u = driver->get_user(rgw_user());
   s->set_user(u);
 
@@ -307,9 +303,10 @@ int process_request(rgw::sal::Driver* const driver,
   RGWOp* op = nullptr;
   int init_error = 0;
   bool should_log = false;
+  RGWREST* rest = penv.rest;
   RGWRESTMgr *mgr;
   RGWHandler_REST *handler = rest->get_handler(driver, s,
-                                               auth_registry,
+                                               *penv.auth_registry,
                                                frontend_prefix,
                                                client_io, &mgr, &init_error);
   rgw::dmclock::SchedulerCompleter c;
@@ -328,8 +325,8 @@ int process_request(rgw::sal::Driver* const driver,
     abort_early(s, NULL, -ERR_METHOD_NOT_ALLOWED, handler, yield);
     goto done;
   }
-  s->lua_background = lua_background;
-  s->lua_manager = lua_manager.get();
+  s->lua_background = penv.lua_background;
+  s->lua_manager = penv.lua_manager.get();
   {
     s->trace_enabled = tracing::rgw::tracer.is_enabled();
     std::string script;
@@ -339,7 +336,7 @@ int process_request(rgw::sal::Driver* const driver,
     } else if (rc < 0) {
       ldpp_dout(op, 5) << "WARNING: failed to read pre request script. error: " << rc << dendl;
     } else {
-      rc = rgw::lua::request::execute(driver, rest, olog, s, op, script);
+      rc = rgw::lua::request::execute(driver, rest, penv.olog, s, op, script);
       if (rc < 0) {
         ldpp_dout(op, 5) << "WARNING: failed to execute pre request script. error: " << rc << dendl;
       }
@@ -360,7 +357,7 @@ int process_request(rgw::sal::Driver* const driver,
 
   try {
     ldpp_dout(op, 2) << "verifying requester" << dendl;
-    ret = op->verify_requester(auth_registry, yield);
+    ret = op->verify_requester(*penv.auth_registry, yield);
     if (ret < 0) {
       dout(10) << "failed to authorize request" << dendl;
       abort_early(s, op, ret, handler, yield);
@@ -424,7 +421,7 @@ done:
     } else if (rc < 0) {
       ldpp_dout(op, 5) << "WARNING: failed to read post request script. error: " << rc << dendl;
     } else {
-      rc = rgw::lua::request::execute(driver, rest, olog, s, op, script);
+      rc = rgw::lua::request::execute(driver, rest, penv.olog, s, op, script);
       if (rc < 0) {
         ldpp_dout(op, 5) << "WARNING: failed to execute post request script. error: " << rc << dendl;
       }
@@ -438,7 +435,7 @@ done:
             << e.what() << dendl;
   }
   if (should_log) {
-    rgw_log_op(rest, s, op, olog);
+    rgw_log_op(rest, s, op, penv.olog);
   }
 
   if (http_ret != nullptr) {
index 5326c1572c84245e6a38ce7d5b18a483695565eb..fad155c0fa0f1e7944dcb88e385d1a37e1d8cc81 100644 (file)
@@ -155,20 +155,14 @@ public:
   void set_access_key(RGWAccessKey& key) { access_key = key; }
 };
 /* process stream request */
-extern int process_request(rgw::sal::Driver* driver,
-                           RGWREST* rest,
+extern int process_request(const RGWProcessEnv& penv,
                            RGWRequest* req,
                            const std::string& frontend_prefix,
-                           const rgw_auth_registry_t& auth_registry,
                            RGWRestfulIO* client_io,
-                           OpsLogSink* olog,
                            optional_yield y,
                            rgw::dmclock::Scheduler *scheduler,
                            std::string* user,
                            ceph::coarse_real_clock::duration* latency,
-                           std::shared_ptr<RateLimiter> ratelimit,
-                           rgw::lua::Background* lua_background,
-                           std::unique_ptr<rgw::sal::LuaManager>& lua_manager,
                            int* http_ret = nullptr);
 
 extern int rgw_process_authenticated(RGWHandler_REST* handler,