Code

store: Let sdb_store_scan() pass on filters to callback functions.
[sysdb.git] / src / include / core / store.h
index 97bb6e65cd56be1afff6a6da035a6ab0ae18803b..2720db472f30abd4c853b7c1c805979749407f25 100644 (file)
@@ -381,12 +381,20 @@ sdb_store_matcher_t *
 sdb_store_isnnull_matcher(sdb_store_expr_t *expr);
 
 /*
- * sdb_store_child_matcher:
- * Creates a matcher matching an object's children of the specified type. It
- * matches if *any* of those children match 'm'.
+ * sdb_store_any_matcher:
+ * Creates a matcher iterating over objects of the specified type. It matches
+ * if *any* of those objects match 'm'.
  */
 sdb_store_matcher_t *
-sdb_store_child_matcher(int type, sdb_store_matcher_t *m);
+sdb_store_any_matcher(int type, sdb_store_matcher_t *m);
+
+/*
+ * sdb_store_all_matcher:
+ * Creates a matcher iterating over objects of the specified type. It matches
+ * if *all* of those objects match 'm'.
+ */
+sdb_store_matcher_t *
+sdb_store_all_matcher(int type, sdb_store_matcher_t *m);
 
 /*
  * sdb_store_lt_matcher, sdb_store_le_matcher, sdb_store_eq_matcher,
@@ -532,24 +540,26 @@ sdb_store_matcher_matches(sdb_store_matcher_t *m, sdb_store_obj_t *obj,
 /*
  * sdb_store_lookup_cb:
  * Lookup callback. It is called for each matching object when looking up data
- * in the store. The lookup aborts if the callback returns non-zero.
+ * in the store passing on the lookup filter and the specified user-data. The
+ * lookup aborts early if the callback returns non-zero.
  */
-typedef int (*sdb_store_lookup_cb)(sdb_store_obj_t *obj, void *user_data);
+typedef int (*sdb_store_lookup_cb)(sdb_store_obj_t *obj,
+               sdb_store_matcher_t *filter, void *user_data);
 
 /*
  * sdb_store_scan:
- * Look up objects in the store. The specified callback function is called for
- * each object in the store matching 'm'. The function performs a full scan of
- * all hosts stored in the database. If specified, the filter will be used to
- * preselect objects for further evaluation. See the description of
- * 'sdb_store_matcher_matches' for details.
+ * Look up objects of the specified type in the store. The specified callback
+ * function is called for each object in the store matching 'm'. The function
+ * performs a full scan of all objects stored in the database. If specified,
+ * the filter will be used to preselect objects for further evaluation. See
+ * the description of 'sdb_store_matcher_matches' for details.
  *
  * Returns:
  *  - 0 on success
  *  - a negative value else
  */
 int
-sdb_store_scan(sdb_store_matcher_t *m, sdb_store_matcher_t *filter,
+sdb_store_scan(int type, sdb_store_matcher_t *m, sdb_store_matcher_t *filter,
                sdb_store_lookup_cb cb, void *user_data);
 
 /*
@@ -602,24 +612,6 @@ int
 sdb_store_host_tojson(sdb_store_obj_t *host, sdb_strbuf_t *buf,
                sdb_store_matcher_t *filter, 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_obj_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