diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2013-09-06 16:57:32 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2013-10-15 15:23:49 +0200 |
commit | 232956f843460b162bb3a1c341dbb9d633539ccf (patch) | |
tree | 021f7d0860d15f850c2cca5dfc96456fd37e9bf9 /src/journald/instutil.h | |
parent | dc89f1d788001d4180acafbe51b4e64bdb1bde3f (diff) | |
download | openlmi-providers-232956f843460b162bb3a1c341dbb9d633539ccf.tar.gz openlmi-providers-232956f843460b162bb3a1c341dbb9d633539ccf.tar.xz openlmi-providers-232956f843460b162bb3a1c341dbb9d633539ccf.zip |
journald: Add support for iterators
This implements CIM_MessageLog iterator functionality according to
the model. The only limitation, or, let's say shortcoming, is a
free-form output data format from the GetRecord call. Currently we
feed the uint8 array with UTF-8 chars and it's up to the client to
deal with it (as suggested in the model). This may be subject to
change.
Many methods are returning modified iterator that has been passed
in and that allows having persistent iterators. As long as CIMOMs
may destroy the instances and unload providers on inactivity, any
particular delay would cause loss of the iterator. The iterator
string contains journal cursor string, uniquely identifying a
record. When this part of the iterator string is valid, the
provider is able to reopen journal and seek to that position,
allowing seamless continuation of the itearation process. If the
cursor points to non-existing record, an error is returned. This
typically happens when journal is rotated or the cursor is very
old.
The provider keeps track of active iterators during its lifetime,
keeping the journal open for fast access. Clients are supposed to
close the iterator by calling the CancelIteration method.
Diffstat (limited to 'src/journald/instutil.h')
-rw-r--r-- | src/journald/instutil.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/journald/instutil.h b/src/journald/instutil.h index ee823c5..0ba7ff1 100644 --- a/src/journald/instutil.h +++ b/src/journald/instutil.h @@ -21,6 +21,8 @@ #ifndef INSTUTIL_H_ #define INSTUTIL_H_ +#include <glib.h> +#include <konkret/konkret.h> #include <systemd/sd-journal.h> #include <ind_manager.h> @@ -35,4 +37,13 @@ bool ind_filter_cb(const CMPISelectExp *filter); bool ind_gather(const IMManager *manager, CMPIInstance **old, CMPIInstance **new, void *data); void ind_destroy(); +gchar * journal_iter_new(const gchar *req_cursor, sd_journal **journal_out); +bool journal_iter_parse_iterator_string(const char *iter_id, gchar **out_iter_id_short, gpointer *out_iter_ptr, gchar **out_iter_cursor); +bool journal_iter_validate_id(gchar **iter_id, sd_journal **journal_out, gchar **prefix_out, const CMPIBroker *_cb, CMPIStatus *status); +bool journal_iter_cancel(const gchar *iter_id); +bool journal_iter_seek(gchar **iter_id, sd_journal *journal, gint64 position); +gchar * journal_iter_get_data(gchar **iter_id, sd_journal *journal, gboolean step_next); +void journal_iters_destroy(); + + #endif /* INSTUTIL_H_ */ |