adoroszlai opened a new pull request, #7514:
URL: https://github.com/apache/ozone/pull/7514

   ## What changes were proposed in this pull request?
   
   Dynamically registered subcommands all implement `SubcommandWithParent`.  
The parent command is identified by `getParentType()`.
   - Each top-level command (`OzoneAdmin`, `OzoneDebug`, etc.) has to load all 
implementors of `SubcommandWithParent`, only to discard most of them.  This 
increases command startup latency, which is a minor problem for short-lived 
commands, e.g. `ozone sh`.
   - Finding children of a parent command is also a bit harder.
   
   This change introduces a way to limit the search scope of subcommands:
   - parent commands can implement `ExtensibleParentCommand` to indicate they 
support dynamically registered subcommands
   - subcommands implement the marker interface returned by the parent 
command's `subcommandType()`
   
   As an example, `OzoneAdmin` and its subcommands are converted to this new 
model.
   
   Benefits:
   - Slightly less startup time for `ozone admin` (240 ms vs. 500 ms for me 
locally)
   - Easier to find subcommands (implementors of `AdminSubcommand` in this case)
   - The same subcommand may be added to multiple parents, just like with 
`subcommands = { ... }` declaration, but unlike `SubcommandWithParent`, which 
allows only one parent.
   - Subcommands only need to access the marker interface.  The actual parent 
command can be in another module (`hdds-tools` vs. `ozone-tools`).
   
   https://issues.apache.org/jira/browse/HDDS-11831
   
   ## How was this patch tested?
   
   CI:
   https://github.com/adoroszlai/ozone/actions/runs/12107950425


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to