Removing objects from D-bus, changing their interfaces #57
Replies: 3 comments 8 replies
-
Hello @dragomirecky
It is actually quite deterministic if you don't create circular references. Remember that CPython uses the reference counting as its primary mechanism for resource control. Once all references get dropped the object will disappear from D-Bus. The garbage collector only comes in play when a circular reference was created. (for example list that contains it self) However, I might add some kind of call to guaranteed remove object from exported objects.
The sd-bus allows exporting new vtables under same path if they don't share the interface names. So it might already be possible with the current API as long as the interfaces are different. (meaning classes are not related) However, is there a particular design pattern that can use objects adding and removing interfaces? |
Beta Was this translation helpful? Give feedback.
-
Yep, you are right and I am aware of that. However, still such an API is a bit clumsy to use when there is a need to have fine-control of when the object disappears from the D-bus. Or be able to remove an object from D-bus without deallocating it (and being able to reexport it later). I would welcome something like remove_from_dbus() method. In case we would agree on the API, I might create a PR with that.
Thanks, that is good to know and that solves my problem π
From reading the D-bus documentation I got the impression that generally, the granularity at which things are added/removed to D-bus are interfaces. For example the ObjectManager interface, which has InterfaceAdded/Removed signals. And it would (maybe) fit one of my project's needs to dynamically expose additional interface on an object, when I find out it has another feature available. But feel free to correct me if I am getting it wrong, I am new to D-bus |
Beta Was this translation helpful? Give feedback.
-
0.12.RC1 has been released which includes the handle: https://github.com/python-sdbus/python-sdbus/releases/tag/0.12.RC1 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
First of all, nice library! Thanks!
I am trying it on a new project and I might be missing two features. So I would like to discuss what is your plan regarding those and if I might be of help somehow.
First: Is there a way to unexport an object from D-bus? The only thing I found is that it gets removed when the object is removed by the GC. However, that is hard-to-work with and it is quite nondeterministic.
Second (and lower priority to me than the first one): What about adding & removing interfaces of an exported object? Have you how this would be done with the current api?
And once again, thanks for the libraryβΊοΈ
Beta Was this translation helpful? Give feedback.
All reactions