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.
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 thepackage 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 theirRegistrySourceInitializer
. 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 thepackage 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.