Code

store.h: Make it such that HOST/SERVICE/METRIC don't share bits with ATTRIBUTE
[sysdb.git] / src / include / core / store.h
index 580dce06b9a184c17e0c25ce7bc25b75b312be75..2253d55a417ed65f75a422c244810bbdd02e6f8f 100644 (file)
@@ -35,6 +35,7 @@
 #include "core/timeseries.h"
 #include "utils/strbuf.h"
 
+#include <stdbool.h>
 #include <stdio.h>
 
 #ifdef __cplusplus
@@ -48,7 +49,8 @@ enum {
        SDB_HOST = 1,
        SDB_SERVICE,
        SDB_METRIC,
-       SDB_ATTRIBUTE,
+
+       SDB_ATTRIBUTE = 1 << 4,
 
        /*
         * Queryable fields of a stored object.
@@ -151,7 +153,7 @@ sdb_store_host(const char *name, sdb_time_t last_update);
  * sdb_store_get_host increments the ref count of the host object. The caller
  * needs to deref it when no longer using it.
  */
-_Bool
+bool
 sdb_store_has_host(const char *name);
 
 sdb_store_obj_t *
@@ -332,6 +334,18 @@ sdb_store_get_attr(sdb_store_obj_t *obj, const char *name, sdb_data_t *res,
 sdb_store_expr_t *
 sdb_store_expr_create(int op, sdb_store_expr_t *left, sdb_store_expr_t *right);
 
+/*
+ * sdb_store_expr_typed:
+ * Creates an expression which evaluates in the context of an object's sibling
+ * as specified by the given type.
+ *
+ * Returns:
+ *  - an expression object on success
+ *  - NULL else
+ */
+sdb_store_expr_t *
+sdb_store_expr_typed(int typ, sdb_store_expr_t *expr);
+
 /*
  * sdb_store_expr_fieldvalue:
  * Creates an expression which evaluates to the value of the specified
@@ -400,7 +414,7 @@ sdb_store_matcher_t *
 sdb_store_con_matcher(sdb_store_matcher_t *left, sdb_store_matcher_t *right);
 
 /*
- * sdb_store_con_matcher::
+ * sdb_store_inv_matcher::
  * Creates a matcher matching the inverse (logical NOT) of a matcher.
  */
 sdb_store_matcher_t *