[Tarantool-patches] [PATCH v2 00/15] RFC: module api: extend for external key_def Lua module

Alexander Turenko alexander.turenko at tarantool.org
Sun Oct 11 15:57:33 MSK 2020


See cover letter for the v1 patchset ([1]) for the background
information.

The patchset still in progress, shared to collect feedback earlier.
Sorry for that, the deadline is very soon...

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-September/019583.html

Changelog from v1 to v2
-----------------------

- 1.10 patchset: polished description of 'lua: adjust contract of
  luaT_tuple_new()' commit.
- Restructured patches around luaT_tuple_encode() and luaT_tuple_new() in order
  to minimize diffs considering that I decided to fix #5382 ('luaT_tuple_new()
  raises a Lua error that leads to various problems') before exposing those
  functions.
- Fixed #5382: luaT_tuple_new() don't raise an error anymore (same for the
  luaT_tuple_encode()).
- Encode to the box region in luaT_tuple_encode().
- Added the preliminary commit 'lua: factor out tuple encoding from
  luaT_tuple_new' to simplify the changes above a bit.
- Changed prefix from 'refactoring' to 'module api' or 'module api/lua' in
  commits regarding API_EXPORT macro.
- Moved key_def_api.[ch] functions back to key_def.[ch] and group them instead.
- Removed the dangerous advice about box region ('data allocated on this region
  are freed eventually').
- Clarified when box_region_alloc() and box_region_aligned_alloc() should be
  used.
- Removed box_region_alloc_object() and box_region_alloc_array() macros from
  the module API.
- Fixed typos, ordering in src/exports.h, Doxygen comments style and so on.
- Removed MULTIKEY_NONE from the API.
- Dropped 'allow_nullable' parameter from key validation function.
- Added copying of collation name from <struct coll_id> in
  box_key_def_dump_parts().
- Renamed box_key_def_new_ex() to box_key_def_new_v2().
- Fixed OOM and zero parts count handling in box_key_def_new_v2().
- Dropped BOX_KEY_PART_DEF_IS_NULLABLE_SHIFT, cut _MASK from
  BOX_KEY_PART_DEF_IS_NULLABLE_MASK.
- Renamed box_tuple_extract_key_ex() to box_key_def_extract_key().
- Renamed box_tuple_validate_key_parts() to box_key_def_validate_tuple().
- Added a note for box_region_align_alloc() that alignment must be a power of
  2.
- Added a basic box region test.
- Added a luaL_iscdata() test.
- Added a basic luaT_tuple_new() test.
- Clarified box_key_part_def_create() guarantees.
- Added basic tests for box_key_part_def_create() and box_key_def_new_v2().
- Added test for box_key_def_dump_parts().
- Added basic test for test_key_def_validate_tuple().

Plan for v3
-----------

- Write basic test cases.
  - box_key_def_merge()
  - box_key_def_extract_key()
  - box_key_def_validate_key()
- Try to simplify commits that introduces luaT_tuple_encode().
- Add @ChangeLog.
- Polish something like order of functions and so on if time will
  permit.

Looks like I have the evening and the night for that. Challenge
accepted.

Issues
------

https://github.com/tarantool/tarantool/issues/5313 ('module api: module
API requires C11')
https://github.com/tarantool/tarantool/issues/5273 ('module api: expose
everything that is needed for external key_def module')

Branches
--------

https://github.com/tarantool/tarantool/tree/Totktonada/gh-5273-expand-module-api
(top 15 commits)
https://github.com/tarantool/tarantool/tree/Totktonada/gh-5273-expand-module-api-1.10
(outdated now, will update a bit later)

Alexander Turenko (15):
  module api: get rid of typedef redefinitions
  module api: expose box region
  module api/lua: add luaL_iscdata() function
  lua: factor out tuple encoding from luaT_tuple_new
  lua: don't raise a Lua error from luaT_tuple_new()
  WIP: module api/lua: add luaT_tuple_encode()
  module api/lua: expose luaT_tuple_new()
  module api/lua: add API_EXPORT to tuple functions
  module api: add API_EXPORT to key_def functions
  module api: add box_key_def_new_v2()
  module api: add box_key_def_dump_parts()
  module api: expose box_key_def_validate_tuple()
  WIP: module api: expose box_key_def_merge()
  WIP: module api: expose box_key_def_extract_key()
  WIP: module api: add box_key_def_validate_key()

 src/CMakeLists.txt               |   2 +-
 src/box/index.h                  |   5 +-
 src/box/key_def.c                | 251 +++++++++++
 src/box/key_def.h                | 226 +++++++++-
 src/box/lua/tuple.c              | 204 +++++++--
 src/box/lua/tuple.h              |  46 +-
 src/exports.h                    |  14 +
 src/lib/core/fiber.c             |  24 ++
 src/lib/core/fiber.h             |  76 ++++
 src/lua/utils.c                  |   6 +
 src/lua/utils.h                  |  20 +
 test/app-tap/CMakeLists.txt      |   6 +
 test/app-tap/module_api.c        | 713 +++++++++++++++++++++++++++++++
 test/app-tap/module_api.test.lua |  58 ++-
 test/unit/luaT_tuple_new.c       |  42 +-
 test/unit/luaT_tuple_new.result  |   6 +-
 16 files changed, 1639 insertions(+), 60 deletions(-)

-- 
2.25.0



More information about the Tarantool-patches mailing list