]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
rgw/lua: allow metatable fields to be cached
authorYuval Lifshitz <ylifshit@redhat.com>
Thu, 22 Jun 2023 09:06:21 +0000 (09:06 +0000)
committerYuval Lifshitz <ylifshit@redhat.com>
Wed, 9 Aug 2023 14:30:16 +0000 (14:30 +0000)
commit481649aedcd281a6b5966a7cbcf68c81fa3de55c
treeb1acade19022e4b3e5eb8b289b6b0401134c1a8b
parentfdf77969055f92284135924eee3b0c9870160fb3
rgw/lua: allow metatable fields to be cached

this is by making metatable names fully qualified names
that contain the entire "path" for reaching them and not
just the name of the object they point to.

with the fix, the code would either create a new metatable,
as in this case:

local o1 = Request.Object
-- new metatable is created to represent the Object in Request.Object
local o2 = Request.CopyFrom.Object
-- new metatable (with different upvalues) is created to represent Request.CopyFrom.Object
print(o1.Name)
print(o2.Name)

or, will reuse an existing metatable, as in this case:

local o1 = Request.Object
-- new metatable is created to represent the Object in Request.Object
local o2 = Request.Object
-- reuse the same metatable
print(o1.Name)
print(o2.Name)

Fixes: https://tracker.ceph.com/issues/58412
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/rgw_lua_background.cc
src/rgw/rgw_lua_background.h
src/rgw/rgw_lua_data_filter.cc
src/rgw/rgw_lua_request.cc
src/rgw/rgw_lua_utils.h
src/test/rgw/test_rgw_lua.cc