Proposing ObjectManager interface

David Zeuthen zeuthen at gmail.com
Sun Feb 27 04:28:20 PST 2011


Hey,

Given all the discussion about performance and roundtrips, I should
probably mention the ObjectManager interface I was working on some
time ago. It is easiest described by the docs for these

 http://people.freedesktop.org/~david/gdbus-binding-tool-20100902/GDBusObjectManager.html
 http://people.freedesktop.org/~david/gdbus-binding-tool-20100902/GDBusProxyManager.html#GDBusProxyManager.description
 http://people.freedesktop.org/~david/gdbus-binding-tool-20100902/

types that I intent to land in the next GLib release (along with the
gdbus-codegen(1) program). One application that uses this stuff is the
upcoming udisks 2.0 (that additionally changes the udisks D-Bus API
radically). You can check that out in the gdbus-port branch of udisks

 http://cgit.freedesktop.org/udisks/log/?h=gdbus-port

but it is best described by this simple screenshot

 http://people.freedesktop.org/~david/udisks-command-in-living-color.png

basically showing the ObjectManager interface in action.

Clearly the ObjectManager interface is not necessarily the right fit
for every application out there, but it does make it very easy to
safely, reliably and cheaply synchronize a bunch of objects among
clients in a race-free way.

Concretely, what I'm proposing is that we add this interface to the spec

  <interface name="org.freedesktop.DBus.ObjectManager">
    <method name="GetAll">
      <arg type="a(oa(sa{sv}))"
name="object_paths_interfaces_and_properties" direction="out"/>
    </method>
    <signal name="InterfacesAdded">
      <arg type="o" name="object_path"/>
      <arg type="a(sa{sv})" name="interfaces_and_properties"/>
    </signal>
    <signal name="InterfacesRemoved">
      <arg type="o" name="object_path"/>
      <arg type="as" name="interfaces"/>
    </signal>
  </interface>

  Clients start priming their caches by calling the method
  org.gtk.GDBus.ObjectManager.GetAll(). This returns an array of all
  existing objects along with the interfaces and properties for each
  object. Every time a new object is added (or an existing object
  gains one or more new interfaces), the signal
  org.gtk.GDBus.ObjectManager::InterfacesAdded is emitted. This
  signal contains all properties for the added interfaces. Similarly,
  every time an object is removed (or an existing object loses one
  or more interfaces) the org.gtk.GDBus.ObjectManager::InterfacesRemoved
  signal is emitted.

Thanks,
David


More information about the dbus mailing list