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/concepts/configuration.rst
+5-5
Original file line number
Diff line number
Diff line change
@@ -184,7 +184,7 @@ Enabling and configuring roles
184
184
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185
185
186
186
An application role is a Lua module that implements specific functions or logic.
187
-
You can enable or turn off a specific role for certain instances in a configuration without restarting these instances.
187
+
You can enable or turn off a particular role for certain instances in a configuration without restarting these instances.
188
188
189
189
This section describes how to enable and configure roles.
190
190
To learn how to develop custom roles, see :ref:`application_roles`.
@@ -240,9 +240,9 @@ Roles and configuration scopes
240
240
******************************
241
241
242
242
As the most of configuration options, roles and their configurations can be defined at :ref:`different levels <configuration_scopes>`.
243
-
Given that the ``roles`` option has the ``array`` type and ``roles_cfg`` has the ``map`` type, there are some specifics when applying the configuration:
243
+
Given that the ``roles`` option has the ``array`` type and ``roles_cfg`` has the ``map`` type, there are some specifics of applying the configuration:
244
244
245
-
- For ``roles``, an instance's role takes precedence over roles defined at another levels.
245
+
- For ``roles``, an instance's role takes precedence over roles defined at another level.
246
246
In the example below, ``instance001`` has only ``role3``:
247
247
248
248
.. code-block:: yaml
@@ -258,7 +258,7 @@ Given that the ``roles`` option has the ``array`` type and ``roles_cfg`` has the
258
258
259
259
- For ``roles_cfg``, the following rules are applied:
260
260
261
-
- If a configuration for the same role is provided at different levels, an instance configuration takes precedence over configuration defined at another levels.
261
+
- If a configuration for the same role is provided at different levels, an instance configuration takes precedence over the configuration defined at another level.
262
262
In the example below, ``role1.greeting`` is ``'Hi'``:
263
263
264
264
.. code-block:: yaml
@@ -275,7 +275,7 @@ Given that the ``roles`` option has the ``array`` type and ``roles_cfg`` has the
275
275
role1:
276
276
greeting: 'Hi'
277
277
278
-
- If configurations for different roles are provided at different levels, both configurations are applied at the instance level.
278
+
- If the configurations for different roles are provided at different levels, both configurations are applied at the instance level.
279
279
In the example below, ``instance001`` has ``role1.greeting`` set to ``'Hi'`` and ``role2.farewell`` set to ``'Bye'``:
Copy file name to clipboardExpand all lines: doc/how-to/app/app_roles.rst
+14-14
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Application roles
4
4
=================
5
5
6
6
An application role is a Lua module that implements specific functions or logic.
7
-
You can enable or turn off a specific role for certain instances in a :ref:`configuration <configuration>` without restarting these instances.
7
+
You can enable or turn off a particular role for certain instances in a :ref:`configuration <configuration>` without restarting these instances.
8
8
A role is run when a configuration is loaded or reloaded.
9
9
10
10
Roles can be divided into the following groups:
@@ -14,7 +14,7 @@ Roles can be divided into the following groups:
14
14
- Roles provided by third-party Lua modules.
15
15
For example, the `CRUD <https://github.com/tarantool/crud>`__ module provides the ``roles.crud-storage`` and ``roles.crud-router`` roles that enable CRUD operations in a sharded cluster.
16
16
- Custom roles that are developed as a part of a cluster application.
17
-
For example, you create a custom role to define a stored procedure or implement a supplementary service, such as an email notifier or a replicator.
17
+
For example, you can create a custom role to define a stored procedure or implement a supplementary service, such as an email notifier or a replicator.
18
18
19
19
This section describes how to develop custom roles.
20
20
To learn how to enable and configure roles, see :ref:`configuration_application_roles`.
@@ -61,12 +61,12 @@ Creating a custom role
61
61
Overview
62
62
~~~~~~~~
63
63
64
-
The main steps of creating a custom role might include the following steps:
64
+
Creating a custom role includes the following steps:
65
65
66
66
1. Define a function that validates a role's configuration.
67
67
2. Define a function that applies a validated configuration.
68
68
3. Define a function that stops a role.
69
-
4. (Optional) Define roles from which a custom role depends on.
69
+
4. (Optional) Define roles from which this custom role depends on.
70
70
71
71
As a result, a role's module should return an object that has corresponding functions and fields specified:
72
72
@@ -104,7 +104,7 @@ In the example below, the ``validate()`` function is used to validate the ``gree
104
104
:end-before: local function apply
105
105
:dedent:
106
106
107
-
If the configuration is not valid, ``validate`` reports an unrecoverable error by throwing an error object.
107
+
If the configuration is not valid, ``validate()`` reports an unrecoverable error by throwing an error object.
108
108
109
109
110
110
@@ -114,8 +114,8 @@ If the configuration is not valid, ``validate`` reports an unrecoverable error b
114
114
Applying a role configuration
115
115
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116
116
117
-
To apply a validated configuration, define the :ref:`apply([cfg]) <roles_api_reference_apply>` function.
118
-
As the ``validate()`` function, ``apply()`` also provides access to a role's configuration using the ``cfg`` argument.
117
+
To apply the validated configuration, define the :ref:`apply([cfg]) <roles_api_reference_apply>` function.
118
+
As the ``validate()`` function, ``apply()`` provides access to a role's configuration using the ``cfg`` argument.
119
119
120
120
In the example below, the ``apply()`` function uses the :ref:`log <log-module>` module to write a role's configuration value to the log:
121
121
@@ -248,7 +248,7 @@ Roles' life cycle includes the stages described below.
248
248
249
249
2) *Stopping roles*
250
250
251
-
This stage is in effect on configuration reload when a role is removed from configuration for the given instance.
251
+
This stage is in effect on configuration reload when a role is removed from a configuration for the given instance.
252
252
Note that all ``stop()`` calls are performed before any ``validate()`` or ``apply()`` calls.
253
253
This means that old roles are stopped first and only then new roles are started.
254
254
@@ -268,7 +268,7 @@ Roles' life cycle includes the stages described below.
268
268
All role's functions report an unrecoverable error by throwing an error object.
269
269
If an error is thrown in any phase, applying a configuration is stopped.
270
270
If starting or stopping a role throws an error, no roles are stopped or started afterward.
271
-
An error is catched and shown in :ref:`config:info() <config_api_reference_info>` in the ``alerts`` section.
271
+
An error is caught and shown in :ref:`config:info() <config_api_reference_info>` in the ``alerts`` section.
272
272
273
273
274
274
.. _roles_life_cycle_dependencies_specifics:
@@ -285,7 +285,7 @@ Suppose, there are two independent roles (``role1``, ``role2``) and three roles
285
285
└─── role4
286
286
└─── role5
287
287
288
-
The roles are enable in a configuration as follows:
288
+
The roles are enabled in a configuration as follows:
289
289
290
290
.. code-block:: yaml
291
291
@@ -298,13 +298,13 @@ In this case, ``validate()`` and ``apply()`` for these roles are executed in the
298
298
role1 -> role2 -> role5 -> role4 -> role3
299
299
300
300
Roles removed from a configuration are stopped in the order reversed to the order they are specified in a configuration, taking into account the dependencies.
301
-
If all roles except ``role1`` are removed from the configuration above, ...
301
+
Suppose, all roles except ``role1`` are removed from the configuration above:
302
302
303
303
.. code-block:: yaml
304
304
305
305
roles: [ role1 ]
306
306
307
-
... ``stop()`` functions for removed roles are executed in the following order:
307
+
After reloading a configuration, ``stop()`` functions for the removed roles are executed in the following order:
308
308
309
309
.. code-block:: none
310
310
@@ -326,7 +326,7 @@ The example below shows how to enable the custom ``greeter`` role for ``instance
326
326
:end-at: greeter
327
327
:dedent:
328
328
329
-
You can define the ``validate()``, ``apply()``, and ``stop()`` functions in the role's code as follows:
0 commit comments