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

Deregister entity tree API in entity store #3227

Open
albinsuresh opened this issue Nov 6, 2024 · 0 comments
Open

Deregister entity tree API in entity store #3227

albinsuresh opened this issue Nov 6, 2024 · 0 comments
Labels
idea ideas/opportunities/feature requests which need to be further investigated before implementation

Comments

@albinsuresh
Copy link
Contributor

albinsuresh commented Nov 6, 2024

Is your feature request related to a problem? Please describe.

The existing tedge_api::entity_store::EntityStore impl doesn't have any APIs to remove an entity, along with its children from the entity store. Implementing is also not trivial as the entities are currently stored in a HashMap and retrieving all the children of a given entity would involve multiple iterations over the entire map looking for each @parent, which isn't efficient.

Describe the solution you'd like

Add a function with the following signature that accepts the topic id of the parent entity to be removed, along with its children, and returns the list of all the entities that were removed:

deregister(topic_id: &EntityTopicId) -> Result<Vec<EntityTopicId>, Error>

To make the retrieval of the child tree more efficient, a tree of EntityTopicIds can also be maintained along with the HashMap, which can further be used in the deregsiter API implementation. The same tree structure can be used to support search APIs to be added in future, to fetch things like all immediate child devices of a given device, all services of a given device etc.

@albinsuresh albinsuresh added the idea ideas/opportunities/feature requests which need to be further investigated before implementation label Nov 6, 2024
@didier-wenzek didier-wenzek self-assigned this Nov 6, 2024
@didier-wenzek didier-wenzek removed their assignment Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea ideas/opportunities/feature requests which need to be further investigated before implementation
Projects
None yet
Development

No branches or pull requests

2 participants