-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roles #3702
Comments
Epic: #3544. |
This was referenced Mar 4, 2024
Closed
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related dev. issue(s): tarantool/tarantool#9078
Related doc. issue(s): #3883, #3670
Product: Tarantool
Since: 3.0
Root document:
SME: @ ImeevMA
Details
Two new options have been added: "roles" and "roles_cfg". The first one
is an array and the second one is a map. Each of these can be defined
per instance, replica set, group, and globally. As with almost all other
options, with the exception of those defined as 'map', the 'roles'
option for the lower scope will replace the roles for the higher scope.
Value roles_cfg however defined as "map", so it will be merged.
The "roles" option defines the roles for each instance. A role is a
program that runs when a configuration is loaded or reloaded. If a role
is defined more than once on an instance, it will still only be run
once. Three functions must be defined in the role: validate(), apply()
and stop(). Each of these functions should throw an error if it occurs.
The "roles_cfg" option specifies the configuration for each role. In
this option, the role name is the key and the role configuration is the
value.
On each run, all roles will be loaded (if necessary) in the order in
which they were specified; the configuration for each role will then be
validated using the corresponding validate() function in the same order;
and then they will all be run with apply() function in the same order.
If some roles have been removed from the instance, they will be stopped
in reverse order using the stop() function.
Example of a role structure:
Requested by @ ImeevMA in tarantool/tarantool@5288440.
Example
Config:
init.lua
:Router code:
Storage code:
The text was updated successfully, but these errors were encountered: