Code

store: Added matchers comparing two expressions.
[sysdb.git] / src / core / store-private.h
index 30091a75a466e28351383be46a3e61883999f70a..4f9b9b59f71d4d103540020ed2dba04cc09a7a5a 100644 (file)
@@ -78,10 +78,22 @@ typedef struct {
 #define SVC(obj) ((sdb_service_t *)(obj))
 #define CONST_SVC(obj) ((const sdb_service_t *)(obj))
 
+typedef struct {
+       sdb_store_obj_t super;
+
+       sdb_avltree_t *attributes;
+       struct {
+               char *type;
+               char *id;
+       } store;
+} sdb_metric_t;
+#define METRIC(obj) ((sdb_metric_t *)(obj))
+
 typedef struct {
        sdb_store_obj_t super;
 
        sdb_avltree_t *services;
+       sdb_avltree_t *metrics;
        sdb_avltree_t *attributes;
 } sdb_host_t;
 #define HOST(obj) ((sdb_host_t *)(obj))
@@ -95,8 +107,10 @@ typedef struct {
  * conditionals
  */
 
-/* compares a host using the specified conditional */
-typedef int (*cmp_cb)(sdb_host_t *, sdb_store_cond_t *);
+/* compares an object using the specified conditional and taking the specified
+ * filter into account */
+typedef int (*cmp_cb)(sdb_store_obj_t *, sdb_store_cond_t *,
+               sdb_store_matcher_t *);
 
 struct sdb_store_cond {
        sdb_object_t super;
@@ -110,6 +124,13 @@ typedef struct {
 } attr_cond_t;
 #define ATTR_C(obj) ((attr_cond_t *)(obj))
 
+typedef struct {
+       sdb_store_cond_t super;
+       int field;
+       sdb_store_expr_t *expr;
+} obj_cond_t;
+#define OBJ_C(obj) ((obj_cond_t *)(obj))
+
 /*
  * matchers
  */
@@ -127,6 +148,11 @@ enum {
        MATCHER_EQ,
        MATCHER_GE,
        MATCHER_GT,
+       MATCHER_CMP_LT,
+       MATCHER_CMP_LE,
+       MATCHER_CMP_EQ,
+       MATCHER_CMP_GE,
+       MATCHER_CMP_GT,
        MATCHER_ISNULL,
 };
 
@@ -177,6 +203,16 @@ typedef struct {
 } uop_matcher_t;
 #define UOP_M(m) ((uop_matcher_t *)(m))
 
+/* compare operator matcher */
+typedef struct {
+       sdb_store_matcher_t super;
+
+       /* left and right hand expressions */
+       sdb_store_expr_t *left;
+       sdb_store_expr_t *right;
+} cmp_matcher_t;
+#define CMP_M(m) ((cmp_matcher_t *)(m))
+
 /* match any type of object by it's name */
 typedef struct {
        sdb_store_matcher_t super;