Code

sysdb: Use a custom output format instead of pretty-printed JSON.
[sysdb.git] / src / include / core / store.h
index 5f60c8dfb0a4a1091953ab3a82d8d4a36632fefb..5e8a2a77be0a6257eda63f2196c250027612b491 100644 (file)
@@ -32,6 +32,7 @@
 #include "core/object.h"
 #include "core/data.h"
 #include "core/time.h"
+#include "core/timeseries.h"
 #include "parser/ast.h"
 #include "utils/strbuf.h"
 
@@ -50,6 +51,7 @@ enum {
        SDB_METRIC,
 
        SDB_ATTRIBUTE = 1 << 4,
+       SDB_TIMESERIES = 1 << 6,
 
        /*
         * Queryable fields of a stored object.
@@ -70,6 +72,7 @@ enum {
                : ((t) == (SDB_ATTRIBUTE | SDB_HOST)) ? "host attribute" \
                : ((t) == (SDB_ATTRIBUTE | SDB_SERVICE)) ? "service attribute" \
                : ((t) == (SDB_ATTRIBUTE | SDB_METRIC)) ? "metric attribute" \
+               : ((t) == SDB_TIMESERIES) ? "timeseries" \
                : "unknown")
 
 #define SDB_FIELD_TO_NAME(f) \
@@ -125,6 +128,8 @@ typedef struct {
 typedef struct {
        const char *type;
        const char *id;
+       const sdb_timeseries_info_t *info;
+       sdb_time_t last_update;
 } sdb_metric_store_t;
 
 /*
@@ -133,17 +138,17 @@ typedef struct {
 typedef struct {
        const char *hostname;
        const char *name;
-       struct {
-               const char *type;
-               const char *id;
-       } store;
+
+       /* All data stores providing this metric. */
+       const sdb_metric_store_t *stores;
+       size_t stores_num;
 
        sdb_time_t last_update;
        sdb_time_t interval;
        const char * const *backends;
        size_t backends_num;
 } sdb_store_metric_t;
-#define SDB_STORE_METRIC_INIT { NULL, NULL, { NULL, NULL }, 0, 0, NULL, 0 }
+#define SDB_STORE_METRIC_INIT { NULL, NULL, NULL, 0, 0, 0, NULL, 0 }
 
 /*
  * sdb_store_attribute_t represents a stored attribute.