Add engine version identifier and expose this ID over the DBus API

Bug #462890 reported by Markus Korn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zeitgeist Framework
Fix Released
Undecided
Markus Korn

Bug Description

The latest changes to the API demonstrate that we need an API version ID and we also should make this ID accessible over DBus, something like:

>>> iface = DBusInterface()
>>> iface.getVersion()
'0.3'

Sample usecases:
* some (external) dataprovider might only work with some API versions
* same for client

Related branches

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

This is a standardized DBus Properties interface we can use for this...

We might also want to version our DBus interfaces (like fx. Tracker does since 0.7), but that is not exactly what this bug is about...

Revision history for this message
Markus Korn (thekorn) wrote :

I implemented a Properties interface in lp:~thekorn/zeitgeist/dbus.properties
The 'version' property is a read-only property which returns a version tuple.

Example usage:

>>> from zeitgeist.dbusutils import DBusInterface
>>> iface = DBusInterface()
>>> iface.version()
dbus.Struct((dbus.Int32(0), dbus.Int32(3), dbus.Int32(0)), signature=None, variant_level=1)
>>> map(int, iface.version())
[0, 3, 0]
>>> iface.version() > (0, 1, 0)
True
>>> iface.version() > (1, 5, 0)
False

Or in a terminal

markus@thekorn ~ % dbus-send --print-reply --dest=org.gnome.zeitgeist /org/gnome/zeitgeist org.freedesktop.DBus.Properties.Get string:"org.gnome.zeitgeist" string:"version"
method return sender=:1.170 -> dest=:1.171 reply_serial=2
   variant struct {
         int32 0
         int32 3
         int32 0
      }
markus@thekorn ~ % dbus-send --print-reply --dest=org.gnome.zeitgeist /org/gnome/zeitgeist org.freedesktop.DBus.Properties.GetAll string:"org.gnome.zeitgeist"
method return sender=:1.179 -> dest=:1.180 reply_serial=2
   array [
      dict entry(
         string "version"
         variant struct {
               int32 0
               int32 3
               int32 0
            }
      )
   ]
markus@thekorn ~ % dbus-send --print-reply --dest=org.gnome.zeitgeist /org/gnome/zeitgeist org.freedesktop.DBus.Properties.Set string:"org.gnome.zeitgeist" string:"version" string:"booo"
Error org.freedesktop.DBus.Python.AttributeError: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/media/devel/gnome-zeitgeist/zeitgeist/dbus.properties/zeitgeist/../_zeitgeist/engine/remote.py", line 265, in Set
    raise AttributeError(property_name)
AttributeError: version

1 markus@thekorn ~ %

Revision history for this message
Markus Korn (thekorn) wrote :

Targeted to 0.3, because of the to be expected API change.

Changed in zeitgeist:
assignee: nobody → Markus Korn (thekorn)
status: New → In Progress
milestone: none → 0.3
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

I think it looks really good. Easy to extend with new properties, readable, as well as writable. You should propose the branch for a merge.

Revision history for this message
Markus Korn (thekorn) wrote :

Merge proposal is at https://code.edge.launchpad.net/~thekorn/zeitgeist/dbus.properties/+merge/14188

Mikkel, did I implement the DBus Properties correctly, is it following your proposal in comment #1?

Revision history for this message
Seif Lotfy (seif) wrote :

I think this is done for right?

Markus Korn (thekorn)
Changed in zeitgeist:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.