Skip to content
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

meshreg: refactoring source initialisation code to improve extensibility #501

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

believening
Copy link
Contributor

For the meshregistry module, integrating a new registry source based on the legacy code required not only implementing the integrated logic for the corresponding registry center within the package source, but also duplicating certain formatted code within the package server to complete the registration of the new registry source. This approach not only introduced redundant work but also led to bloated function bodies as the number of registry sources increased. To address this, we have refactored the code responsible for source registration and initialization to enhance extensibility.

For registry sources, we have defined an initializer, RegistrySourceInitializer, to constrain the parameters used and the returns for creating sources, while also providing a function for registry sources to register their RegistrySourceInitializer. Since the parameters for creating sources and their returns are now fixed, we can standardize the process of building and starting various registry sources within the package server. This normalization makes it much easier to integrate new registry sources and significantly simplifies our code. (revolve #488)

For more details about RegistrySourceInitializer, please refer to its comments.

There is still an outstanding issue: different registry sources have their own unique configurations. For newly integrated registry sources, it is still necessary to continuously add new fields to the bootstrap.RegistryArgs structure. We anticipate providing a more user-friendly and extensible configuration interface in the future.

@wbpcode wbpcode merged commit 5b43d6b into slime-io:master Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants