Top.Mail.Ru
box.space._func | Tarantool
Tarantool
Check out the new release 2.8
Submodule box.space box.space._func

box.space._func

box.space._func

box.space._func

_func is a system space with function tuples made by box.schema.func.create() or box.schema.func.create(func-name [, {options-with-body}]).

Tuples in this space contain the following fields:

  • id (integer identifier),
  • owner (integer identifier),
  • the function name,
  • the setuid flag,
  • a language name (optional): ‘LUA’ (default) or ‘C’.
  • the body
  • the is_deterministic flag
  • the is_sandboxed flag
  • options

If the function tuple was made in the older way without specification of body, then the _func space will contain default values for the body and the is_deterministic flag and the is_sandboxed flag. Such function tuples are called “not persistent”. You continue to create Lua functions in the usual way, by saying function function_name () ... end, without adding anything in the _func space. The _func space only exists for storing function tuples so that their names can be used within grant/revoke functions.

If the function tuple was made the newer way with specification of body, then all the fields may contain non-default values. Such functions are called “persistent”. They should be invoked with box.func.func-name:call([parameters]).

You can:

Example:

In the following example, we create a function named ‘f7’, put it into Tarantool’s _func space and grant ‘execute’ privilege for this function to ‘guest’ user.

tarantool> function f7()
         >  box.session.uid()
         > end
---
...
tarantool> box.schema.func.create('f7')
---
...
tarantool> box.schema.user.grant('guest', 'execute', 'function', 'f7')
---
...
tarantool> box.schema.user.revoke('guest', 'execute', 'function', 'f7')
---
...