summaryrefslogtreecommitdiffstats
path: root/src/rgw
diff options
context:
space:
mode:
Diffstat (limited to 'src/rgw')
-rw-r--r--src/rgw/rgw_appmain.cc9
-rw-r--r--src/rgw/rgw_lua_data_filter.cc4
-rw-r--r--src/rgw/rgw_lua_request.cc4
-rw-r--r--src/rgw/rgw_main.h3
-rw-r--r--src/rgw/rgw_op.cc4
-rw-r--r--src/rgw/rgw_process.cc4
-rw-r--r--src/rgw/rgw_process_env.h8
-rw-r--r--src/rgw/rgw_realm_reloader.cc1
8 files changed, 22 insertions, 15 deletions
diff --git a/src/rgw/rgw_appmain.cc b/src/rgw/rgw_appmain.cc
index 23c60074c40..396cc5b9b41 100644
--- a/src/rgw/rgw_appmain.cc
+++ b/src/rgw/rgw_appmain.cc
@@ -407,8 +407,6 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
env.auth_registry = rgw::auth::StrategyRegistry::create(
dpp->get_cct(), *implicit_tenant_context, env.driver);
env.ratelimiting = ratelimiter.get();
- env.lua_background = lua_background.get();
- env.lua_manager = env.driver->get_lua_manager();
int fe_count = 0;
for (multimap<string, RGWFrontendConfig *>::iterator fiter = fe_map.begin();
@@ -472,8 +470,8 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
fe_pauser = std::make_unique<RGWFrontendPauser>(fes, pusher.get());
rgw_pauser = std::make_unique<RGWPauser>();
rgw_pauser->add_pauser(fe_pauser.get());
- if (lua_background) {
- rgw_pauser->add_pauser(lua_background.get());
+ if (env.lua.background) {
+ rgw_pauser->add_pauser(env.lua.background);
}
reloader = std::make_unique<RGWRealmReloader>(
env, *implicit_tenant_context, service_map_meta, rgw_pauser.get());
@@ -536,10 +534,13 @@ void rgw::AppMain::init_lua()
}
#endif
+ env.lua.manager = env.driver->get_lua_manager();
+
if (driver->get_name() == "rados") { /* Supported for only RadosStore */
lua_background = std::make_unique<
rgw::lua::Background>(driver, dpp->get_cct(), driver->get_luarocks_path());
lua_background->start();
+ env.lua.background = lua_background.get();
}
} /* init_lua */
diff --git a/src/rgw/rgw_lua_data_filter.cc b/src/rgw/rgw_lua_data_filter.cc
index 28052739016..9ebaf345388 100644
--- a/src/rgw/rgw_lua_data_filter.cc
+++ b/src/rgw/rgw_lua_data_filter.cc
@@ -103,9 +103,9 @@ int RGWObjFilter::execute(bufferlist& bl, off_t offset, const char* op_name) con
lua_pushinteger(L, offset);
lua_setglobal(L, "Offset");
- if (s->penv.lua_background) {
+ if (s->penv.lua.background) {
// create the "RGW" table
- s->penv.lua_background->create_background_metatable(L);
+ s->penv.lua.background->create_background_metatable(L);
lua_getglobal(L, rgw::lua::RGWTable::TableName().c_str());
ceph_assert(lua_istable(L, -1));
}
diff --git a/src/rgw/rgw_lua_request.cc b/src/rgw/rgw_lua_request.cc
index a902d7345da..53b055bf388 100644
--- a/src/rgw/rgw_lua_request.cc
+++ b/src/rgw/rgw_lua_request.cc
@@ -879,8 +879,8 @@ int execute(
lua_pushcclosure(L, RequestLog, FOUR_UPVALS);
lua_rawset(L, -3);
- if (s->penv.lua_background) {
- s->penv.lua_background->create_background_metatable(L);
+ if (s->penv.lua.background) {
+ s->penv.lua.background->create_background_metatable(L);
lua_getglobal(L, rgw::lua::RGWTable::TableName().c_str());
ceph_assert(lua_istable(L, -1));
}
diff --git a/src/rgw/rgw_main.h b/src/rgw/rgw_main.h
index d6e6de37a8c..321fbfc8009 100644
--- a/src/rgw/rgw_main.h
+++ b/src/rgw/rgw_main.h
@@ -25,7 +25,6 @@
#include "rgw_realm_reloader.h"
#include "rgw_ldap.h"
#include "rgw_lua.h"
-#include "rgw_lua_background.h"
#include "rgw_dmclock_scheduler_ctx.h"
#include "rgw_ratelimit.h"
@@ -51,6 +50,8 @@ public:
namespace rgw {
+namespace lua { class Background; }
+
class RGWLib;
class AppMain {
/* several components should be initalized only if librgw is
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 8258cffc604..a21c4a8aace 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -2088,7 +2088,7 @@ int RGWGetObj::get_data_cb(bufferlist& bl, off_t bl_ofs, off_t bl_len)
int RGWGetObj::get_lua_filter(std::unique_ptr<RGWGetObj_Filter>* filter, RGWGetObj_Filter* cb) {
std::string script;
- const auto rc = rgw::lua::read_script(s, s->penv.lua_manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::getData, script);
+ const auto rc = rgw::lua::read_script(s, s->penv.lua.manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::getData, script);
if (rc == -ENOENT) {
// no script, nothing to do
return 0;
@@ -3875,7 +3875,7 @@ static CompressorRef get_compressor_plugin(const req_state *s,
int RGWPutObj::get_lua_filter(std::unique_ptr<rgw::sal::DataProcessor>* filter, rgw::sal::DataProcessor* cb) {
std::string script;
- const auto rc = rgw::lua::read_script(s, s->penv.lua_manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::putData, script);
+ const auto rc = rgw::lua::read_script(s, s->penv.lua.manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::putData, script);
if (rc == -ENOENT) {
// no script, nothing to do
return 0;
diff --git a/src/rgw/rgw_process.cc b/src/rgw/rgw_process.cc
index 96e3cecf1a7..8d20251f8f7 100644
--- a/src/rgw/rgw_process.cc
+++ b/src/rgw/rgw_process.cc
@@ -329,7 +329,7 @@ int process_request(const RGWProcessEnv& penv,
{
s->trace_enabled = tracing::rgw::tracer.is_enabled();
std::string script;
- auto rc = rgw::lua::read_script(s, penv.lua_manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::preRequest, script);
+ auto rc = rgw::lua::read_script(s, penv.lua.manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::preRequest, script);
if (rc == -ENOENT) {
// no script, nothing to do
} else if (rc < 0) {
@@ -414,7 +414,7 @@ done:
}
}
std::string script;
- auto rc = rgw::lua::read_script(s, penv.lua_manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::postRequest, script);
+ auto rc = rgw::lua::read_script(s, penv.lua.manager.get(), s->bucket_tenant, s->yield, rgw::lua::context::postRequest, script);
if (rc == -ENOENT) {
// no script, nothing to do
} else if (rc < 0) {
diff --git a/src/rgw/rgw_process_env.h b/src/rgw/rgw_process_env.h
index 5648add8649..f1577608e3c 100644
--- a/src/rgw/rgw_process_env.h
+++ b/src/rgw/rgw_process_env.h
@@ -20,12 +20,16 @@ namespace rgw::sal {
class LuaManager;
}
+struct RGWLuaProcessEnv {
+ rgw::lua::Background* background = nullptr;
+ std::unique_ptr<rgw::sal::LuaManager> manager;
+};
+
struct RGWProcessEnv {
+ RGWLuaProcessEnv lua;
rgw::sal::Driver* driver = nullptr;
RGWREST *rest = nullptr;
OpsLogSink *olog = nullptr;
std::unique_ptr<rgw::auth::StrategyRegistry> auth_registry;
ActiveRateLimiter* ratelimiting = nullptr;
- rgw::lua::Background* lua_background = nullptr;
- std::unique_ptr<rgw::sal::LuaManager> lua_manager;
};
diff --git a/src/rgw/rgw_realm_reloader.cc b/src/rgw/rgw_realm_reloader.cc
index bb82c5ccbb6..182cf16392f 100644
--- a/src/rgw/rgw_realm_reloader.cc
+++ b/src/rgw/rgw_realm_reloader.cc
@@ -180,6 +180,7 @@ void RGWRealmReloader::reload()
* the dynamic reconfiguration. */
env.auth_registry = rgw::auth::StrategyRegistry::create(
cct, implicit_tenants, env.driver);
+ env.lua.manager = env.driver->get_lua_manager();
ldpp_dout(&dp, 1) << "Resuming frontends with new realm configuration." << dendl;