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

inserting plugins and top-level items into sh #705

Open
Morg42 opened this issue Jan 20, 2025 · 1 comment
Open

inserting plugins and top-level items into sh #705

Morg42 opened this issue Jan 20, 2025 · 1 comment
Assignees
Labels
core Issue relates to the core of SmartomeNG enhancement question
Milestone

Comments

@Morg42
Copy link
Member

Morg42 commented Jan 20, 2025

At the moment, during initialization of shng,

first, each plugin is inserted as shng.<plg_section>,

second, each top-level item is inserted as shng.<item_top_path>

This has lead to collisions, at least for me. So, as there is no check if plugin identifier or item path are already present, the previous is overwritten by the latter.

Proposal:

  1. to not change anything, leave the system in place (at least for now)
  2. create a namespace (empty object? plugins/items class?) below shng
  3. create plugin/item references in these namespaces

So, instead of (in addition to...) sh.<plugin1>, sh.<plugin2>, sh.<item1>, sh.<item2>, we would be able to use sh.plugins.<plugin1>, sh.plugins.<plugin2>, sh.items.<item1>, sh.items.<item2>

Caveat: if using lib.plugins and lib.items as namespace, make quite sure that plugin/item names don't overwrite plugins/items members (easy to implement...)

Pros:

  • structured access
  • collision free (in regard between items and plugins)
  • nonbreaking
  • cleanup for later; dynamic plugin unload might remove ref to item/item tree (!))

Cons:

  • collisions still possible with namespace methods
  • larger memory footprint, though probably neglectible, (# of plugins + # of top level items) * ref size

Any comments or ideas?

Implementation is fairly simple and already mentally prepared ;)

@Morg42 Morg42 added core Issue relates to the core of SmartomeNG enhancement question labels Jan 20, 2025
@Morg42 Morg42 added this to the Version 1.12 milestone Jan 20, 2025
@Morg42
Copy link
Member Author

Morg42 commented Jan 24, 2025

While trying to implement this, I found that items are already referenced in sh and sh.items, so this just does the same for plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issue relates to the core of SmartomeNG enhancement question
Projects
None yet
Development

No branches or pull requests

5 participants