• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 12077515526
88%

Build:
DEFAULT BRANCH: master
Ran 29 Nov 2024 01:45AM UTC
Jobs 1
Files 518
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Nov 2024 01:30AM UTC coverage: 87.336% (+0.03%) from 87.302%
12077515526

push

github

Totktonada
config: add on_event callback for roles

This patch add `on_event` callback for roles.

Closes #10538
Closes TNTP-225

@TarantoolBot document
Title: `on_event` callback for roles

Roles can now set a `on_event` callback, which will be called
every time a `box.status` system event is broadcasted or the
configuration has been updated (after the `apply` has finished).

`on_event` callbacks are called one after another in the order
the roles are applied (according to their dependencies). Each
event (`box.status` or configuration change) triggers a series
of callbacks, next series (for a new event) will be triggered
after the previous finishes.

`on_event` callbacks are executed inside a `pcall` and if error is
raised, it is logged with 'error' level and the series execution
continues.

It is guaranteed that all of the `on_event` triggers are executed as
part of the configuration process (and 'ready' or 'check_warnings'
status is reached only after all of them are done).

When the callback is called, three arguments are provided,
`on_event(config, key, value)` where:
`config` is the current configuration,
`key` is `'config.apply'` if the callback was trigger by configuration
update, or `'box.status'` if it was triggered by `box.status` system
event.
`value` is the same as in `box.status` system event.

Example usage:

```lua
return {
    name = 'my_role',
    validate = ...,
    apply = ...,
    stop = ...,
    on_event = function(config, key, value)
        local log = require('log')

        log.info('on_event is triggered by ' .. key)
        log.info('is_ro: ' .. value.is_ro)

        local roles_cfg = config:get('roles_cfg')
        roles_cfg['my_role']...
    end,
}
```

69501 of 123342 branches covered (56.35%)

102449 of 117304 relevant lines covered (87.34%)

3043172.14 hits per line

Jobs
ID Job ID Ran Files Coverage
1 12077515526.1 29 Nov 2024 01:45AM UTC 0
87.34
GitHub Action Run
Source Files on build 12077515526
Detailed source file information is not available for this build.
  • Back to Repo
  • 88e656cd on github
  • Prev Build on master (#12077365187)
  • Next Build on master (#12077912174)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc