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 sayingfunction 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 withbox.func.func-name:call([parameters])
.You can:
- Create a
_func
tuple with box.schema.func.create(). - Drop a
_func
tuple with box.schema.func.drop(). - Check whether a
_func
tuple exists with box.schema.func.exists().
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') --- ...
The system space view for
_func
is_vfunc
.