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

Handling runtime tree modifications #40

Closed
agrover opened this issue Apr 11, 2016 · 6 comments
Closed

Handling runtime tree modifications #40

agrover opened this issue Apr 11, 2016 · 6 comments

Comments

@agrover
Copy link
Contributor

agrover commented Apr 11, 2016

Object paths supported by a tree may come and go. Tree has an add() but lacks remove(). It's easy to add a remove() that just removes it from self.paths, but it looks like we also need to call c.unregister_object_path...but only if after set_registered() has been called. So basically I'm thinking to enable adding/removing object paths at runtime we need to either pass c to add() & remove() and register/unregister within those functions, but then we don't really need set_registered() any more? But then maybe we want to unregister any remaining paths from Drop?

Wanted to get your thoughts on what it would take to properly enable this.

@agrover
Copy link
Contributor Author

agrover commented Apr 12, 2016

Or maybe, moving the Connection from TreeServer to Tree might be the right thing to do? A bigger change, though.

@diwic
Copy link
Owner

diwic commented Apr 12, 2016

A basic workaround for this is to add and remove trees rather than paths in the tree. You can have one tree for every path, if you like.

@diwic
Copy link
Owner

diwic commented Apr 12, 2016

Or maybe, moving the Connection from TreeServer to Tree might be the right thing to do? A bigger change, though.

No, that'll break some use case someone else had, which was "send message to tree in another thread, do lengthy processing without blocking main thread, send result over to main thread and send reply"

A basic workaround for this is to add and remove trees rather than paths in the tree. You can have one tree for every path, if you like.

On second thought, this will only work for paths that are not children of paths in another tree, because that'll break introspection, GetManagedObjects etc, because they won't find its children if they are in another tree.

@diwic
Copy link
Owner

diwic commented Apr 12, 2016

The idea of having a tree.remove() function that allows you to modify your object path and then put it back in is appealing. Perhaps tree.add() and tree.remove() could take an additional Option<&Connection> that would optionally auto-register/unregister? (Or have tree.add_and_register() / tree.remove_and_unregister() functions.)

@diwic
Copy link
Owner

diwic commented Apr 12, 2016

This won't fix sending out org.freedesktop.DBus.ObjectManager.InterfacesAdded if you remove an object path, add an interface to it, and then put it back in, but perhaps that's a separate problem we can think of some other time.

diwic added a commit that referenced this issue Apr 22, 2016
Signed-off-by: David Henningsson <diwic@ubuntu.com>
@diwic
Copy link
Owner

diwic commented Apr 30, 2016

Fixed in v0.3.3 (at least removing object paths from a tree - maybe want to remove interfaces from object paths, methods from interfaces etc etc in the future)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants