Add standard DBus interface for managing the lifetime of objects based on shared ownership
Submitted by Will Manley
Assigned to D-Bus Maintainers
Description
Created attachment 48571 Patch to DBus specification describing interface RefCounted
In our system[1] we have a DBus server that is in charge of playing back, recording, buffering, etc. video media. Clients that want a video stream recorded or played back ask a DBus server to create an object for doing this. While the object lives in the server, really it belongs to the client, and as such the server should remove it from its connection and and destroy it when the client becomes disinterested in it. There is the additional complexity that the server might have sent one of these objects to multiple clients or may have sent the same object to a particular client multiple times.
I wanted to extend the warm fuzzy feeling that in-process reference counted pointers gives you, but to our multi-process system. I wanted it to be asynchronous and non-chatty and I think I have achieved this.
Given that it was quite tricky to get right I thought it might be useful to other DBus users for it to become a standard DBus interface. That way it is more likely that it might be implemented in bindings (other than my own).
I have attached a patch to the DBus spec describing what I've done. I'm not expecting it to be immediately accepted but I created the patch so we would have something concrete to discuss. As smcv said on IRC today "my rule of thumb would be, propose it as a standard D-Bus interface when you find your second use-case ;)". Hopefully this use-case will surface.
[1] YouView TV set top boxes ( http://www.youview.com )
Patch 48571, "Patch to DBus specification describing interface RefCounted":
0001-Add-standard-interface-org.freedestop.DBus.RefCounte.patch
Version: 1.5