index 1d4e019a01fe45db4d464c9bd387a2258d04b83d..85f278c74dd374d56c24011f06bb6a568f32cd26 100644 (file)
#include "core/object.h"
#include "core/store.h"
+#include "core/timeseries.h"
#include "utils/strbuf.h"
#include <inttypes.h>
/* user information */
char *username; /* NULL if the user has not been authenticated */
+ _Bool ready; /* indicates that startup finished successfully */
};
#define CONN(obj) ((sdb_conn_t *)(obj))
* node types
*/
-typedef struct {
- sdb_conn_node_t super;
- char *name;
-} conn_fetch_t;
-#define CONN_FETCH(obj) ((conn_fetch_t *)(obj))
-
typedef struct {
sdb_conn_node_t super;
sdb_store_matcher_t *matcher;
typedef struct {
sdb_conn_node_t super;
+ int type;
+ conn_matcher_t *filter;
+} conn_list_t;
+#define CONN_LIST(obj) ((conn_list_t *)(obj))
+
+typedef struct {
+ sdb_conn_node_t super;
+ int type;
+ char *name;
+ conn_matcher_t *filter;
+} conn_fetch_t;
+#define CONN_FETCH(obj) ((conn_fetch_t *)(obj))
+
+typedef struct {
+ sdb_conn_node_t super;
+ int type;
conn_matcher_t *matcher;
conn_matcher_t *filter;
} conn_lookup_t;
#define CONN_LOOKUP(obj) ((conn_lookup_t *)(obj))
+typedef struct {
+ sdb_conn_node_t super;
+ char *hostname;
+ char *metric;
+ sdb_timeseries_opts_t opts;
+} conn_ts_t;
+#define CONN_TS(obj) ((conn_ts_t *)(obj))
+
/*
* type helper functions
*/
+
+static void __attribute__((unused))
+conn_matcher_destroy(sdb_object_t *obj)
+{
+ sdb_object_deref(SDB_OBJ(CONN_MATCHER(obj)->matcher));
+} /* conn_matcher_destroy */
+
+static void __attribute__((unused))
+conn_list_destroy(sdb_object_t *obj)
+{
+ sdb_object_deref(SDB_OBJ(CONN_LIST(obj)->filter));
+} /* conn_list_destroy */
+
static void __attribute__((unused))
conn_fetch_destroy(sdb_object_t *obj)
{
if (CONN_FETCH(obj)->name)
free(CONN_FETCH(obj)->name);
+ sdb_object_deref(SDB_OBJ(CONN_FETCH(obj)->filter));
} /* conn_fetch_destroy */
static void __attribute__((unused))
-conn_matcher_destroy(sdb_object_t *obj)
+conn_lookup_destroy(sdb_object_t *obj)
{
- if (CONN_MATCHER(obj)->matcher)
- sdb_object_deref(SDB_OBJ(CONN_MATCHER(obj)->matcher));
-} /* conn_matcher_destroy */
+ sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->matcher));
+ sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->filter));
+} /* conn_lookup_destroy */
static void __attribute__((unused))
-conn_lookup_destroy(sdb_object_t *obj)
+conn_ts_destroy(sdb_object_t *obj)
{
- if (CONN_LOOKUP(obj)->matcher)
- sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->matcher));
- if (CONN_LOOKUP(obj)->filter)
- sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->filter));
-} /* conn_lookup_destroy */
+ if (CONN_TS(obj)->hostname)
+ free(CONN_TS(obj)->hostname);
+ if (CONN_TS(obj)->metric)
+ free(CONN_TS(obj)->metric);
+} /* conn_ts_destroy */
#ifdef __cplusplus
} /* extern "C" */