dbus object path
Thiago Macieira
thiago at kde.org
Sat Mar 14 17:18:54 PDT 2009
Michael 'Mickey' Lauer wrote:
>> >Am Dienstag, den 10.03.2009, 14:38 +0300 schrieb Alexandr Lebedev:
>> >> Dear colleagues. Help me please. How I can receive the list of
>> >> objects under the service name?
>> >
>> >This is one of the missing features in dbus. You need to use
>> >introspection. Have a look at dbus-hlid @
>> > http://git.freesmartphone.org which you can use for that.
>>
>> No, you don't.
>
>I can.
Correct, you can. But that was not the point: you said "you need to" and I
replied that "you don't need to".
>> Please read my email: unless you're writing a program whose
>> purpose is to scan existing objects in D-Bus and show them to the user
>> (i.e., a program that is a D-Bus browser), finding objects through
>> introspection is always the wrong solution.
>>
>> The correct thing is to:
>> 1) know the path before-hand (via well-known path) or out-of-band
>> information
>
>Not applicable. Objects can come and go at any time.
Not if they are at a well-known path in a well-known service. That's the
of org.freedesktop.DBus, path /org/freedesktop/DBus. Problem solved with
zero round-trips.
>> or 2) request that the object reveal itself via signalling (one signal
>> request, one reply or method call)
>
>This is a band-aid for something that should be in dbus itself. While
>that works, it sounds like double bookkeeping to me.
I beg to differ. That's hardly double bookkeeping because there is no
bookkeeping in the first place. There's no central registry of objects --
there's not even a registry of objects, distributed or not! Many
applications do have an object tree, but some don't and they just
represent objects on-the-fly.
That's not band-aid. That's the proper way: signalling the presence when
the service starts and another signal for everyone to "sound off". If the
object can disappear with the application not disconnecting, then it can
either use service names to indicate its presence or a signal to indicate
it's going away. The only difficulty is handling timeouts.
That's how you do it in a distributed system without waking up unrelated
applications unnecessarily and hitting them with a storm of requests. Mind
you that some applications generate the XML on-the-fly (especially because
of sub-notes), meaning that introspecting is hardly a cheap operation.
Given that you're working on "free smartphone", I'd expect you to care
about battery life and needless waking up of applications.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20090314/852360e6/attachment.pgp
More information about the dbus
mailing list