From: Yuval Lifshitz Date: Mon, 15 Aug 2022 16:57:09 +0000 (+0300) Subject: Merge pull request #46550 from yuvalif/wip-yuval-lua-filter X-Git-Tag: v18.0.0~265 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ad51b94ab4143bfeb91a8eaf0dd0d00b05428c55;p=ceph.git Merge pull request #46550 from yuvalif/wip-yuval-lua-filter rgw/lua: allow access to object data reviwed-by: cbodley, anthonyeleven --- ad51b94ab4143bfeb91a8eaf0dd0d00b05428c55 diff --cc src/rgw/rgw_admin.cc index 637dab47e42ef,1ed453b500b10..e4add62293728 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@@ -10417,12 -10402,11 +10420,12 @@@ next } const rgw::lua::context script_ctx = rgw::lua::to_context(*str_script_ctx); if (script_ctx == rgw::lua::context::none) { - cerr << "ERROR: invalid script context: " << *str_script_ctx << ". must be one of: preRequest, postRequest, background" << std::endl; + cerr << "ERROR: invalid script context: " << *str_script_ctx << ". must be one of: " << LUA_CONTEXT_LIST << std::endl; return EINVAL; } + auto lua_manager = store->get_lua_manager(); std::string script; - const auto rc = rgw::lua::read_script(dpp(), store, tenant, null_yield, script_ctx, script); + const auto rc = rgw::lua::read_script(dpp(), lua_manager.get(), tenant, null_yield, script_ctx, script); if (rc == -ENOENT) { std::cout << "no script exists for context: " << *str_script_ctx << (tenant.empty() ? "" : (" in tenant: " + tenant)) << std::endl; @@@ -10441,11 -10425,10 +10444,11 @@@ } const rgw::lua::context script_ctx = rgw::lua::to_context(*str_script_ctx); if (script_ctx == rgw::lua::context::none) { - cerr << "ERROR: invalid script context: " << *str_script_ctx << ". must be one of: preRequest, postRequest, background" << std::endl; + cerr << "ERROR: invalid script context: " << *str_script_ctx << ". must be one of: " << LUA_CONTEXT_LIST << std::endl; return EINVAL; } - const auto rc = rgw::lua::delete_script(dpp(), store, tenant, null_yield, script_ctx); + auto lua_manager = store->get_lua_manager(); + const auto rc = rgw::lua::delete_script(dpp(), lua_manager.get(), tenant, null_yield, script_ctx); if (rc < 0) { cerr << "ERROR: failed to remove script. error: " << rc << std::endl; return -rc; diff --cc src/rgw/rgw_lua.h index 562a80c6c3d33,ecc583bd41ba7..405492809f29c --- a/src/rgw/rgw_lua.h +++ b/src/rgw/rgw_lua.h @@@ -1,18 -1,14 +1,19 @@@ #pragma once #include +#include +#include "rgw_lua_version.h" #include "common/async/yield_context.h" +#include "common/dout.h" #include "rgw_sal_fwd.h" + class DoutPrefixProvider; class lua_State; class rgw_user; +class DoutPrefixProvider; namespace rgw::sal { class RadosStore; + class LuaManager; } namespace rgw::lua {