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();
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());
}
#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 */
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));
}
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));
}
#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"
namespace rgw {
+namespace lua { class Background; }
+
class RGWLib;
class AppMain {
/* several components should be initalized only if librgw is
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;
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;
{
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) {
}
}
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) {
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;
};
* 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;
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
// to make sure test is consistent we have to puase the background
lua_background.pause();
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
const auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
s.tagset.add_tag("key1", "val1");
s.tagset.add_tag("key2", "val1");
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
s.tagset.add_tag("key1", "val1");
s.tagset.add_tag("key2", "val2");
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
const auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
const auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
const auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
const auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
const auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_EQ(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_NE(rc, 0);
)";
DEFINE_REQ_STATE;
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
auto rc = lua::request::execute(nullptr, nullptr, nullptr, &s, nullptr, request_script);
ASSERT_NE(rc, 0);
TestBackground lua_background(store.get(), "");
DEFINE_REQ_STATE;
s.host_id = "foo";
- pe.lua_background = &lua_background;
+ pe.lua.background = &lua_background;
lua::RGWObjFilter filter(&s, script);
bufferlist bl;
bl.append("The quick brown fox jumps over the lazy dog");