-
Notifications
You must be signed in to change notification settings - Fork 43
Adds description of the on_event callback to custom application roles #5232
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
Conversation
@@ -81,6 +110,13 @@ As a result, a role module should return an object that has corresponding functi | |||
apply = function() -- ... -- end, | |||
stop = function() -- ... -- end, | |||
dependencies = { -- ... -- }, | |||
on_event = function(config, key, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to indent the function contents:
on_event = function(config, key, value)
local log = require('log')
log.info('roles_cfg.my_role.foo: ' .. config.foo)
log.info('on_event is triggered by ' .. key)
log.info('is_ro: ' .. value.is_ro)
end,
doc/platform/app/app_roles.rst
Outdated
For example, a logging role can be created to add logging functionality on top of the built-in one. | ||
|
||
Since version :doc:`3.4.0 </release/3.4.0>`, you can define an ``on_event`` callback for custom roles. The ``on_event`` callback is called | ||
every time a ``box.status`` system event is broadcasted, or after the ``apply`` action of the configuration update is finished. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO "the apply
action of " this is not needed here. apply
step is a part of the current inner implementation, and should not be important for the users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work! Just some minor comments from me.
Added general info about custom roles as an intro to the section' Fixes #4666
d4cba2f
to
ad4dcfa
Compare
on_event
callback for roles #4666Deployment: https://docs.d.tarantool.io/ru/doc/gh-4666-on-event-callback-for-roles/platform/app/app_roles/#creating-a-custom-role