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/platform/app/app_roles.rst
+15-39Lines changed: 15 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,11 +118,24 @@ As a result, a role module should return an object that has corresponding functi
118
118
end,
119
119
}
120
120
121
-
The examples below show how to do this.
121
+
The examples in this article show how to do this.
122
+
123
+
You can omit the optional steps and get a simple role as in the example below.
124
+
125
+
.. code-block:: lua
126
+
127
+
return {
128
+
validate = function() -- ... -- end,
129
+
apply = function() -- ... -- end,
130
+
stop = function() -- ... -- end,
131
+
}
132
+
133
+
You can modify a role, for example, by adding dependencies or specifying the on_event callback.
134
+
If you modify a role, you need to restart the Tarantool instance with the role in order to apply the changes.
122
135
123
136
.. NOTE::
124
137
125
-
Code snippets shown in this section are included from the following application: `application_role_cfg <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/application_role_cfg>`_.
138
+
- Code snippets shown in this section are included from the following application: `application_role_cfg <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/application_role_cfg>`_.
126
139
127
140
.. _roles_create_custom_role_schema:
128
141
@@ -179,43 +192,6 @@ In the example below, the ``apply()`` function uses the :ref:`log <log-module>`
179
192
:end-before: local function stop
180
193
:dedent:
181
194
182
-
183
-
184
-
.. _roles_create_custom_role_edit:
185
-
186
-
Editing a role
187
-
~~~~~~~~~~~~~~
188
-
189
-
Editing a custom application role object means changing the contents of its LUA file. To edit a role object, you can do the following:
190
-
191
-
* Edit, remove, or set to nil the the role configuration schema;
192
-
193
-
* Edit, remove, or set to nil dependencies;
194
-
195
-
* Edit, remove, or set to nil the ``on_event`` callback function;
196
-
197
-
* Edit the role configuration validation function;
198
-
199
-
* Edit the apply validation function;
200
-
201
-
* Edit the stopping role function.
202
-
203
-
.. code-block:: lua
204
-
205
-
return {
206
-
validate = function() -- ... -- end,
207
-
apply = function() -- ... -- end,
208
-
stop = function() -- ... -- end,
209
-
dependencies = { -- ... -- },
210
-
on_event = nil
211
-
end,
212
-
}
213
-
214
-
215
-
Once the editing of the role object is finished, the :ref:`config:reload() <config_api_reference_reload>` is triggered automatically
216
-
to apply the changes. However, if the :ref:`config.reload <configuration_reference_config_reload>` option is set to ``manual``,
217
-
then the you must manually perform configuration reload or restart the Tarantool instance with the role.
0 commit comments