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

Remove node name duplication in the ListUnits and ListUnitFiles API #916

Open
engelmi opened this issue Jul 22, 2024 · 0 comments
Open

Remove node name duplication in the ListUnits and ListUnitFiles API #916

engelmi opened this issue Jul 22, 2024 · 0 comments
Labels
breaking Requested changes will break existing usages enhancement New feature or request

Comments

@engelmi
Copy link
Member

engelmi commented Jul 22, 2024

Please describe what you would like to see

For the API method ListUnits

the returned structure is a list of all unit (files) and the name of the respective node a(sssssssouso), for example:

[
  ("node-1", ...),
  ("node-1", ...),
  ("node-2", ...),
  ("node-2", ...),
  ...
]

The node name is duplicated quite a lot in this structure. It would be more efficient to use a dict and store it only once, e.g.:

{
  "node-1": [
    (...), (...), ...
  ],
  "node-2": [
    (...), (...), ...
  ],
  ...

This could be achieved by changing the D-Bus API to a{sa(ssssssouso)} - where the dict has the node name as key (basic D-Bus type string) and the unit information as value (container D-Bus type). This way the node name isn't repeated n times for n units.

Notes:
* The same applies for ListUnitFiles (added in #889)
** This is a breaking API change

@engelmi engelmi added enhancement New feature or request breaking Requested changes will break existing usages labels Jul 22, 2024
@mkemel mkemel changed the title Change API of ListUnits and ListUnitFiles Improve the structure of ListUnits and ListUnitFiles API Jul 22, 2024
@mkemel mkemel changed the title Improve the structure of ListUnits and ListUnitFiles API Remove node name duplication in the ListUnits and ListUnitFiles API Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Requested changes will break existing usages enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant