chiark / gitweb /
python-systemd: Reader return special fields and _Reader changes
authorSteven Hiscocks <steven@hiscocks.me.uk>
Sun, 14 Apr 2013 19:55:08 +0000 (20:55 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 17 Apr 2013 04:09:15 +0000 (00:09 -0400)
commit6a58bf4135faa98f1600672179a2bf364d455f7e
tree4a0cf2982935b86b6c50047ac8df0c879abd2212
parent76a80d93b50db2c87719971050b49bebf339f175
python-systemd: Reader return special fields and _Reader changes

Changes to _Reader make it match closer to C API, by removing `get_next`
and `get_previous`. A `get_all` method added, which returns dictionary
of fields using C API SD_JOURNAL_FOREACH_DATA macro, which can be used
in conjunction with `next`.

_Reader `get`, `next`, `get_{realtime,monotonic,cursor}` and new
`previous` methods are made private. This is so the traversal and
getting of journal fields can be made transparent in the python
interface.

Reader now solely implements `get_next` and `get_previous`, returning a
standard dictionary (future: other mapping types?) with all standard and
special fields through the converters. This makes the output the same as
journalctl json/export format output.

Iterator methods also moved to Reader, as they do not function as intend
with changes to _Reader.

These changes also mean that more optimised journal interfaces can be
made more easily from _Reader, by avoiding getting of unrequired fields
by using the `_get` method, and avoiding field conversions.
src/python-systemd/_reader.c
src/python-systemd/journal.py