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/reference/configuration/configuration_reference.rst
+123
Original file line number
Diff line number
Diff line change
@@ -2877,6 +2877,94 @@ This section describes configuration parameters related to roles.
2877
2877
2878
2878
**Since:** :doc:`3.0.0 </release/3.0.0>`.
2879
2879
2880
+
Application roles of an instance.
2881
+
An application role is a Lua module that implement specific functions or logic.
2882
+
2883
+
There two types of application roles:
2884
+
2885
+
- Built-in roles. 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.
2886
+
- Custom roles. For example, you create a custom role to define a stored procedure or implement a supplementary service, such as an e-mail notifier or a replicator.
2887
+
2888
+
To create a custom role, you need to define the following functions and fields:
2889
+
2890
+
- ``validate()``
2891
+
2892
+
Validate a role's configuration.
2893
+
2894
+
- ``apply()``
2895
+
2896
+
Apply a role's configuration.
2897
+
2898
+
- ``stop()``:
2899
+
2900
+
Stop a role.
2901
+
2902
+
- (Optional) ``dependencies``
2903
+
2904
+
Define a role's dependencies.
2905
+
2906
+
Functions should throw an error if it occurs.
2907
+
2908
+
**Example: Built-in role**
2909
+
2910
+
The examples below shows how to enable the ``roles.crud-router`` and ``roles.crud-storage`` roles provided by the `CRUD <https://github.com/tarantool/crud>`__ module on routers and storages, respectively:
You can find the full example here: `sharded_cluster_crud <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/sharding/instances.enabled/sharded_cluster_crud>`_.
2925
+
2926
+
**Example: Custom role**
2927
+
2928
+
The configuration below shows how to assign a custom ``greeter`` role to ``instance001`` and specify configuration for this role:
You can find the full example here: `sharded_cluster_crud <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/application_role>`_.
2943
+
2944
+
**Example: Role dependency**
2945
+
2946
+
The example below shows how to implement the ``greeter`` role:
You can find the full example here: `sharded_cluster_crud <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/application_role>`_.
2966
+
2967
+
2880
2968
|
2881
2969
|Type: array
2882
2970
|Default: nil
@@ -2889,6 +2977,41 @@ This section describes configuration parameters related to roles.
2889
2977
2890
2978
**Since:** :doc:`3.0.0 </release/3.0.0>`.
2891
2979
2980
+
Specify a role's configuration.
2981
+
This option accepts a role name as the key and a role's configuration as the value.
2982
+
2983
+
To specify the roles of an instance, use the :ref:`roles <configuration_reference_roles>` option.
2984
+
2985
+
**Example: Built-in role**
2986
+
2987
+
The example below shows how to enable and configure the ``roles.crud-router`` role provided by the `CRUD <https://github.com/tarantool/crud>`__ module:
You can find the full example here: `sharded_cluster_crud <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/sharding/instances.enabled/sharded_cluster_crud>`_.
2996
+
2997
+
**Example: Custom role**
2998
+
2999
+
The configuration below shows how to assign a custom ``greeter`` role to ``instance001`` and specify configuration for this role:
You can find the full example here: `sharded_cluster_crud <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/application_role>`_.
0 commit comments