Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, vdavydov.dev@gmail.com
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [PATCH v3 0/6] box: rework functions machinery
Date: Thu, 13 Jun 2019 17:08:20 +0300	[thread overview]
Message-ID: <cover.1560433806.git.kshcherbatov@tarantool.org> (raw)

This patchset reworks Tarantool's functions machinery to support
persistent Lua functions and provide an universal way to call any
registered function.

This patchset consists of following conceptual changes:
1. Func updates on alter were simplified: now replace _func tuple is
   forbidden and func_new constructor may fail. This makes possible to
   define a failable function object constructors.
2. box_lua_call and box_lua_eval were refactored to do nottake call_request
   argument and to use input and output port instead. A new msgpack_port allows
   to use this abstraction also for a regular memory msgpack.
3. Introduced an abstract function class and func_c and func_lua
   implementations that allow to call C and Lua functions correspondingly
   with uniform API defined on base func class.
4. Introduced an infrastructure to call functions from Lua. A new box.func
   folder exports functions objects that have :call and :drop methods and their
   definition.
4. Introduced persistent Lua functions. Such functions are a part of Tarantool
   snapshoot so they are available even after restart. The new is_sandboxed
   option initializes a new persistent Lua function is a separate 'sandbox':
   an isolated environment with strong restrictions: only limited number of
   on-board functions are available, no global state is available at all.

Persistent Lua functions is an important step to implement functional indexes
in Tarantool. Only a deterministic, sandboxed, persistent Lua function may
be used as a functional index extractor.

Changes in version 3:
   Source code is re-organised to be bit clear and to provide a better function
   object abstraction.

http://github.com/tarantool/tarantool/tree/kshch/gh-4182-persistent-lua-functions
https://github.com/tarantool/tarantool/issues/4182

Kirill Shcherbatov (6):
  box: rework func cache update machinery
  box: rework box_lua_{call, eval} to use input port
  box: rework func object as a function frontend
  box: export registered functions in box.func folder
  box: refactor box_lua_find helper
  box: introduce Lua persistent functions

 src/box/alter.cc             | 111 ++++---
 src/box/bootstrap.snap       | Bin 4475 -> 4532 bytes
 src/box/call.c               | 151 ++-------
 src/box/call.h               |   4 -
 src/box/execute.c            |   1 +
 src/box/func.c               | 199 +++++++++--
 src/box/func.h               |  40 +--
 src/box/func_def.c           |  25 ++
 src/box/func_def.h           |  34 +-
 src/box/lua/call.c           | 621 +++++++++++++++++++++++++++++++----
 src/box/lua/call.h           |  13 +-
 src/box/lua/execute.c        |   7 +-
 src/box/lua/execute.h        |   4 +-
 src/box/lua/init.c           |   1 +
 src/box/lua/misc.cc          |  10 +-
 src/box/lua/schema.lua       |  41 ++-
 src/box/lua/upgrade.lua      |  25 +-
 src/box/port.c               |   3 +-
 src/box/port.h               |  19 +-
 src/box/schema.cc            |  38 +--
 src/box/schema.h             |  15 +-
 src/box/schema_def.h         |   4 +
 src/box/session.cc           |  11 +-
 src/box/session.h            |   8 +
 src/lib/core/port.h          |  15 +-
 test/box-py/bootstrap.result |   6 +-
 test/box/access_misc.result  |   6 +-
 test/box/function1.c         |  33 ++
 test/box/function1.result    | 332 +++++++++++++++++++
 test/box/function1.test.lua  | 115 +++++++
 test/box/misc.result         |   1 +
 31 files changed, 1544 insertions(+), 349 deletions(-)

-- 
2.21.0

             reply	other threads:[~2019-06-13 14:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 14:08 Kirill Shcherbatov [this message]
2019-06-13 14:08 ` [PATCH v3 1/6] box: rework func cache update machinery Kirill Shcherbatov
2019-06-18 10:52   ` Vladimir Davydov
2019-06-19 15:51     ` [tarantool-patches] " Kirill Shcherbatov
2019-06-13 14:08 ` [PATCH v3 2/6] box: rework box_lua_{call, eval} to use input port Kirill Shcherbatov
2019-06-17  9:35   ` [tarantool-patches] " Konstantin Osipov
2019-06-17 10:27     ` [tarantool-patches] " Kirill Shcherbatov
2019-06-18 12:12   ` Vladimir Davydov
2019-06-19 15:51     ` [tarantool-patches] " Kirill Shcherbatov
2019-06-19 16:11       ` Vladimir Davydov
2019-06-18 13:58   ` Vladimir Davydov
2019-06-19 18:28   ` [tarantool-patches] " Konstantin Osipov
2019-06-20  7:53     ` Kirill Shcherbatov
2019-06-20  8:09       ` Konstantin Osipov
2019-06-20  8:44         ` [tarantool-patches] " Kirill Shcherbatov
2019-06-19 18:30   ` [tarantool-patches] " Konstantin Osipov
2019-06-13 14:08 ` [PATCH v3 3/6] box: rework func object as a function frontend Kirill Shcherbatov
2019-06-18 13:23   ` Vladimir Davydov
2019-06-19 15:51     ` [tarantool-patches] " Kirill Shcherbatov
2019-06-13 14:08 ` [PATCH v3 4/6] box: export registered functions in box.func folder Kirill Shcherbatov
2019-06-18 14:06   ` Vladimir Davydov
2019-06-19 15:51     ` [tarantool-patches] " Kirill Shcherbatov
2019-06-18 16:11   ` Vladimir Davydov
2019-06-13 14:08 ` [PATCH v3 5/6] box: refactor box_lua_find helper Kirill Shcherbatov
2019-06-18 14:22   ` Vladimir Davydov
2019-06-19 15:51     ` [tarantool-patches] " Kirill Shcherbatov
2019-06-13 14:08 ` [PATCH v3 6/6] box: introduce Lua persistent functions Kirill Shcherbatov
2019-06-18 16:23   ` Vladimir Davydov
2019-06-19 15:51     ` [tarantool-patches] " Kirill Shcherbatov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1560433806.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v3 0/6] box: rework functions machinery' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox