From 7e305ff0787c363587883aaf35c2a426d670721e Mon Sep 17 00:00:00 2001 From: Lilla Orban Date: Fri, 12 Apr 2024 15:43:58 +0200 Subject: [PATCH] fix(module-catalog-ADR) - Update ADR-014 --- architecture/adr-014-module-catalog.md | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/architecture/adr-014-module-catalog.md b/architecture/adr-014-module-catalog.md index 3e53e98ff..80f490bad 100644 --- a/architecture/adr-014-module-catalog.md +++ b/architecture/adr-014-module-catalog.md @@ -1,27 +1,28 @@ -| Type | ID | Status | Title | -| ------------- | ------------- | ------------- | ---------------------- | -| ADR | adr-014 | Accepted | Multiple ModuleCatalog | +| Type | ID | Status | Title | +| ------------- | ------------- | ------------- | ----------------------- | +| ADR | adr-014 | Accepted | Multiple ModuleCatalogs | -# Architecture Decision Record: Multiple ModuleCatalog +# Architecture Decision Record: Multiple ModuleCatalogs ## Context -ComposeUI aims to support many different kind of modules and applications. These applications/modules, that can be started via the ModuleLoader should be stored in ModuleCatalogs and every module should have it's unique module id. The user should have the ability to handle multiple ModuleCatalog with the ModuleLoader. +ComposeUI aims to support many different kind of modules. These modules, that can be started by the ModuleLoader should be stored in ModuleCatalogs and every module should have its unique module id. The user should have the ability to handle multiple ModuleCatalogs with the ModuleLoader. General problem statement: +- When multiple ModuleCatalogs are used, some modules could have the same module id in different ModuleCatalogs which could cause issues while starting or stopping the module via the ModuleLoader. -- When multiple ModuleCatalog is being used, some modules could have the same module id in different ModuleCatalog which could cause issue while starting/stopping the application/module via the ModuleLoader. +## Decision +- If the same module id is being used for multiple modules (likely in different ModuleCatalogs), the first occurrence will be used. In case of multiple ModuleCatalog registrations, the order of the registration determines which module can be used. # Alternative solutions that we considered -- Throwing an exception when 2 of the modules have the same moduleId either in one or multiple ModuleCatalog. This might cause an issue that is unresolvable by the developer/user. +- Throwing an exception when multiple modules have the same moduleId either in one or multiple ModuleCatalogs. This might cause an issue that is unresolvable by the developer or the enduser. - Prefixing the modules with the name of the ModuleCatalog, but prefixing ids would be non-standard. -- Aggregating the registered ModuleCatalogs should be implemented by the user/developer of the application. -- First occurence should be only used. - -## Decision -- If the same module id is being used for multiple modules (even in different ModuleCatalogs), the first occurrence will be used/saved via the ModuleLoader. The first occurence means it will be handled in the order of the registrations of the provider (ModuleCatalogs). +- Aggregating the registered ModuleCatalogs should be implemented by the developer of the application. ## Consequences -- Every module should have it's unique id even if they are in different ModuleCatalog. \ No newline at end of file +- Our implementation is more permissive than the standard. +- We must ensure keeping the order of the ModuleCatalog registrations as the order of registrations will determine which module is contained by our aggregated ModuleCatalog in case of duplicate moduleIds. +- We must ensure keeping the order of the modules within the invidual ModuleCatalogs as the order of the registered modules will determine which module is contained by our aggregated ModuleCatalog in case of duplicate moduleIds. +- We must ensure this order when fetching modules asynchronously from the ModuleCatalogs. \ No newline at end of file