dbus-glib: a server with lots of objects

Neal H. Walfield neal at walfield.org
Mon May 9 01:08:10 PDT 2011


Hi,

I'll start by asking my question and then providing some background to
my problem:

Is it possible to listen to all object paths using the dbus-glib
bindings?  What is the best way to accomplish this in a program that
already makes extensive use of dbus-glib?


I am implementing a dbus server that exports lots of objects.  You can
think of it like the spreadsheet example in the dbus specification or
introduction [1].

  [1] http://www.freedesktop.org/wiki/IntroductionToDBus

I am currently using the dbus-glib bindings.  I have two reasons.
First, my program already makes extensive use of dbus-glib.  Second,
even if I wanted to use the gdbus bindings, I don't think it is
possible, because I need to support a system using glib 2.20.

Although I am able to enumerate all objects apriori, I don't want to
call dbus_g_connection_register_g_object for every object.  First,
there are a lot of objects, which I suspect means a fair amount of CPU
overhead.  Second, at any given time, most objects do not exist as
gobjects: they exist in a serialized form in a database and are only
instantiated as gobjects on demand.  Using
dbus_g_connection_register_g_object, I think I would need to
instantiate all objects (or at least a simple wrapper object per real
object) resulting in a large memory overhead.

Is it possible to accomplish this using the dbus-glib bindings?  Do I
need to fallback to the low-level bindings?  (Is there an example of
how to properly integrate both bindings in the same program?  Or, do
you have any tips?)  Should I just pass the object id as a parameter
in the method invocation?  In this case, I don't think I can easily
use the normal org.freedesktop.DBus.Properties interface.

Thanks,

Neal


More information about the dbus mailing list