You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/radosgw/lua-scripting.rst
+25-26Lines changed: 25 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,10 @@ This feature allows users to assign execution context to Lua scripts. The suppor
13
13
- ``background`` which will execute within a specified time interval
14
14
- ``getdata`` which will execute on objects' data when objects are downloaded
15
15
- ``putdata`` which will execute on objects' data when objects are uploaded
16
-
- ``preRequest`` which will execute a script before each operation is performed
17
-
- ``postRequest`` which will execute after each operation is performed
18
16
19
17
A request (pre or post) or data (get or put) context script may be constrained to operations belonging to a specific tenant's users.
20
18
The request context script can also access fields in the request and modify certain fields, as well as the `Global RGW Table`_.
21
-
The data context script can access the content of the object as well as the request fields and the `Global RGW Table`_.
19
+
The data context script can access the content of the object as well as the request fields and the `Global RGW Table`_.
22
20
All Lua language features can be used in all contexts.
23
21
An execution of a script in a context can use up to 500K byte of memory. This include all libraries used by Lua, but not the memory which is managed by the RGW itself, and may be accessed from Lua.
24
22
To change this default value, use the ``rgw_lua_max_memory_per_state`` configuration parameter. Note that the basic overhead of Lua with its standard libraries is ~32K bytes. To disable the limit, use zero.
@@ -30,13 +28,14 @@ By default, the execution of a Lua script is limited to a maximum runtime of 100
30
28
31
29
By default, all Lua standard libraries are available in the script, however, in order to allow for additional Lua modules to be used in the script, we support adding packages to an allowlist:
32
30
31
+
- Make sure that the ``luarocks`` package manager is installed on the host.
33
32
- Adding a Lua package to the allowlist, or removing a packge from it does not install or remove it. For the changes to take affect a "reload" command should be called.
34
33
- In addition all packages in the allowlist are being re-installed using the luarocks package manager on radosgw restart.
35
34
- To add a package that contains C source code that needs to be compiled, use the ``--allow-compilation`` flag. In this case a C compiler needs to be available on the host
36
35
- Lua packages are installed in, and used from, a directory local to the radosgw. Meaning that Lua packages in the allowlist are separated from any Lua packages available on the host.
37
-
By default, this directory would be ``/tmp/luarocks/<entity name>``. Its prefix part (``/tmp/luarocks/``) could be set to a different location via the ``rgw_luarocks_location`` configuration parameter.
36
+
By default, this directory would be ``/tmp/luarocks/<entity name>``. Its prefix part (``/tmp/luarocks/``) could be set to a different location via the ``rgw_luarocks_location`` configuration parameter.
38
37
Note that this parameter should not be set to one of the default locations where luarocks install packages (e.g. ``$HOME/.luarocks``, ``/usr/lib64/lua``, ``/usr/share/lua``).
39
-
38
+
40
39
41
40
.. toctree::
42
41
:maxdepth:1
@@ -46,12 +45,12 @@ Script Management via CLI
46
45
-------------------------
47
46
48
47
To upload a script:
49
-
48
+
50
49
51
50
::
52
51
53
-
# radosgw-admin script put --infile={lua-file-path} --context={prerequest|postrequest|background|getdata|putdata} [--tenant={tenant-name}]
54
-
52
+
# radosgw-admin script put --infile={lua-file-path} --context={prerequest|postrequest|background|getdata|putdata} [--tenant={tenant-name}]
53
+
55
54
* When uploading a script with the ``background`` context, a tenant name should not be specified.
56
55
57
56
::
@@ -62,14 +61,14 @@ To upload a script:
62
61
To print the content of the script to standard output:
63
62
64
63
::
65
-
64
+
66
65
# radosgw-admin script get --context={preRequest|postRequest|background|getdata|putdata} [--tenant={tenant-name}]
0 commit comments