lua: add tweaks module
This commit adds the new 'internal.tweaks' Lua module for toggling internal tweaks. The module is implemented as a Lua table with the __index and __newindex metamethods overridden, which makes it possible to get/set a tweak value with a simple assignment, for example: tarantool> tweaks = require('internal.tweaks') --- ... tarantool> tweaks.fiber_channel_close_mode = 'graceful' --- ... tarantool> tweaks.fiber_channel_close_mode --- - graceful ... (Note, currently there are no tweaks available; tweaks are added in the following commits.) Getting a value of an unknown tweak returns nil. Setting a value of an unknown tweak raises 'No such option' error. Setting an invalid value for an existing tweak raises 'Invalid value' error. The module also implements __serialize and __autocomplete metamethods that return all tweaks and their values in a table, for example: tarantool> tweaks --- - fiber_channel_close_mode: forceful yaml_pretty_multiline: false json_escape_forward_slash_default: true ... Closes #7883 Needed for #8117 NO_DOC=internal NO_CHANGELOG=internal
Showing
- src/CMakeLists.txt 1 addition, 0 deletionssrc/CMakeLists.txt
- src/lua/init.c 2 additions, 0 deletionssrc/lua/init.c
- src/lua/tweaks.c 137 additions, 0 deletionssrc/lua/tweaks.c
- src/lua/tweaks.h 19 additions, 0 deletionssrc/lua/tweaks.h
- test/unit/CMakeLists.txt 9 additions, 0 deletionstest/unit/CMakeLists.txt
- test/unit/lua_tweaks.c 253 additions, 0 deletionstest/unit/lua_tweaks.c
Loading
Please register or sign in to comment