Code

store: Added sdb_store_iterate().
[sysdb.git] / src / include / core / store.h
index 80975087227882a4810fbc9790a15c017b2ba2db..a149b1d714d3b245c36fad7c626d5dd40d564653 100644 (file)
@@ -230,6 +230,24 @@ sdb_store_tojson(sdb_strbuf_t *buf, int flags);
 int
 sdb_store_host_tojson(sdb_store_base_t *host, sdb_strbuf_t *buf, int flags);
 
+/*
+ * sdb_store_iter_cb:
+ * Store iterator callback. Iteration stops if the callback returns non-zero.
+ */
+typedef int (*sdb_store_iter_cb)(sdb_store_base_t *obj, void *user_data);
+
+/*
+ * sdb_store_iterate:
+ * Iterate the entire store, calling the specified callback for each object.
+ * The user_data pointer is passed on to each call of the callback.
+ *
+ * Returns:
+ *  - 0 on success
+ *  - a negative value else
+ */
+int
+sdb_store_iterate(sdb_store_iter_cb cb, void *user_data);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif