session: move all session triggers to the trigger registry
The commit populates submodule session with an event for each public trigger - they will be used for user-defined triggers. Old triggers are not removed because they are used for internal purposes - audit from EE uses them, for instance. Also, the commit introduces a test for all triggers that use old API. It checks only session triggers now - all the other triggers will be included there after they will be moved to the trigger registry. In order to have an opportunity to move user-defined triggers to trigger registry, the commit introduces helper luaT_event_reset_trigger that supports two different ways to set triggers - key-value API and positional API. The first one is a new API that allows to set or delete trigger only by name. The second API is implemented for the sake of backward compatibility - it mimics behavior of function lbox_trigger_reset, which was used to modify triggers, but sets the triggers to event from trigger registry instead of separate trigger list. Also, positional API allows to pass a name as the third argument - in this case the function will set or delete trigger by passed name - the first argument is a new trigger (or nil, if the function is called to delete a trigger), the second argument will be ignored in this case. The new helper supports not only functions - any callable object can be used as a trigger. Part of #6484 Part of #8657 NO_CHANGELOG=later NO_DOC=later
Showing
- src/box/authentication.c 3 additions, 3 deletionssrc/box/authentication.c
- src/box/error.cc 40 additions, 4 deletionssrc/box/error.cc
- src/box/error.h 22 additions, 0 deletionssrc/box/error.h
- src/box/iproto.cc 4 additions, 6 deletionssrc/box/iproto.cc
- src/box/lua/session.c 6 additions, 38 deletionssrc/box/lua/session.c
- src/box/lua/trigger.c 147 additions, 0 deletionssrc/box/lua/trigger.c
- src/box/lua/trigger.h 43 additions, 0 deletionssrc/box/lua/trigger.h
- src/box/schema.h 0 additions, 17 deletionssrc/box/schema.h
- src/box/session.c 68 additions, 5 deletionssrc/box/session.c
- src/box/session.h 4 additions, 0 deletionssrc/box/session.h
- test/box-luatest/triggers_old_api_test.lua 209 additions, 0 deletionstest/box-luatest/triggers_old_api_test.lua
- test/unit/luaT_tuple_new.c 2 additions, 0 deletionstest/unit/luaT_tuple_new.c
- test/unit/tuple_format.c 3 additions, 0 deletionstest/unit/tuple_format.c
Loading
Please register or sign in to comment