core: extend `port_dump_lua` with 'Msgpack object' mode
When data is coming from IPROTO and is passed to Lua, it is convenient to pass raw MsgPack data (see `box.schema.func::takes_raw_args` option). Currently, the port's MsgPack is retrieved directly via `port_get_msgpack` and then a MsgPack object is constructed via `luamp_push`. In the future, ports can have a MsgPack decoding context that will also be needed to be passed to the MsgPack object constructor, so we encapsulate the MsgPack object construction completely into a port method by introducing a new operation mode to `port_dump_lua`. This new operation mode is essentially a no-op for a MsgPack port (which is the case for data coming from IPROTO), and is completely inefficient for other types of ports (since an intermediate conversion to MsgPack occurs), but we do not expect users to be calling Lua stored procedures with the `takes_raw_args` locally. To handle the latter case we introduce a `port_dump_lua_mp_object_mode_slow` helper function which facilitates retrieving MsgPack data from ports via region allocation, creating a Msgpack object and freeing the MsgPack data. Needed for #8147 NO_CHANGELOG=refactoring NO_DOC=refactoring NO_TEST=refactoring
Showing
- src/box/lua/call.c 22 additions, 15 deletionssrc/box/lua/call.c
- src/box/lua/misc.cc 17 additions, 6 deletionssrc/box/lua/misc.cc
- src/box/lua/misc.h 22 additions, 0 deletionssrc/box/lua/misc.h
- src/box/port.c 1 addition, 2 deletionssrc/box/port.c
- src/box/port.h 4 additions, 0 deletionssrc/box/port.h
- src/box/sql/mem.c 15 additions, 2 deletionssrc/box/sql/mem.c
- src/lib/core/port.h 8 additions, 0 deletionssrc/lib/core/port.h
Loading
Please register or sign in to comment