-
Notifications
You must be signed in to change notification settings - Fork 87
Simplify registries: no prefixes, direct sub-registries access #315
Conversation
Handler id prefixes are used only for the sub-handlers (e.g. "parent-id/child-id"), and sub-handlers is a rarely used feature. But the prefixes were implemented as a feature of registries. Move the prefixing to the sub-handlers related code, and remove prefixes from the registries. This should simplify their code.
In order to not get caught in a situation when an arg is forgotten, which can cause misbehaviour or errors. The handlers are hidden from the users, so we have no need to keep their interfaces simple.
🤖 zincr found 0 problems , 1 warning
Details on how to resolve are provided below Large CommitsChecks all commits for large additions to a single file. Large commits should be reviewed more carefully for potential copyright and licensing issues This file contains a substantial change, please review to determine if the change comes from an external source and if there are any copyright or licensing issues to be aware of
|
🤖 zincr found 1 problem , 1 warning
Details on how to resolve are provided below ApprovalsAll proposed changes must be reviewed by project maintainers before they can be merged Not enough people have approved this pull request - please ensure that 1 additional user, who have not contributed to this pull request approve the changes.
Large CommitsChecks all commits for large additions to a single file. Large commits should be reviewed more carefully for potential copyright and licensing issues This file contains a substantial change, please review to determine if the change comes from an external source and if there are any copyright or licensing issues to be aware of
|
What do these changes do?
Refactor the registries massively, to prepare for even more registry and handler types.
Description
Originally, there were sub-registries and one operator registry consisting of sib-registries. And the operator registry was exposing multiple
registed_blah_blah_handler()
,[has|get|iter]_blah_blah_handlers()
methods, so on.As the number of handler type increases, having these proxying methods becomes a problem: they do nothing, just proxy to the actual sub-registries (simple lists), but bring a lot of method signatures that has to be maintained and tested.
With this PR, we remove all of these proxying methods completely (technically, deprecate them and warn if they are used, but keep them for a while until the next major release).
The sub-registries should now be used directly, and its handlers should be accesses via the similar methods (same-named, but different typing signatures: e.g.
[get|iter]_handlers(...)
).Purpose: In the following PRs, even more registry and handler types will be added: e.g. daemons & timers. Not having even more proxying methods seems convenient.
Also, registries prefixes are removed. They were used for the sub-handlers only. Now, the prefixes are implemented directly for sub-handler decorators.
Since registries were never created directly by the users (unlike the accessing methods above), we have no need to keep backward compatible changes for deprecated prefixes — we just drop them.
The end users should not be affected (in theory).
Issues/PRs
Type of changes
Checklist
CONTRIBUTORS.txt