From: Florian Forster Date: Wed, 8 Sep 2010 15:30:55 +0000 (+0200) Subject: src/graph_instance.[ch]: Implement "inst_data_to_json". X-Git-Tag: v4.0.0~36 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2ef734476e3511b6f1c2611875e340b6b8ca2d4c;p=collection4.git src/graph_instance.[ch]: Implement "inst_data_to_json". --- diff --git a/src/graph_ident.h b/src/graph_ident.h index 30d7e69..6d033b3 100644 --- a/src/graph_ident.h +++ b/src/graph_ident.h @@ -29,6 +29,7 @@ #include #include "graph_types.h" +#include "data_provider.h" #define ANY_TOKEN "/any/" #define ALL_TOKEN "/all/" diff --git a/src/graph_instance.c b/src/graph_instance.c index 86cec84..23d88dc 100644 --- a/src/graph_instance.c +++ b/src/graph_instance.c @@ -567,6 +567,20 @@ int inst_to_json (const graph_instance_t *inst, /* {{{ */ return (0); } /* }}} int inst_to_json */ +int inst_data_to_json (const graph_instance_t *inst, /* {{{ */ + dp_time_t begin, dp_time_t end, + yajl_gen handler) +{ + size_t i; + + yajl_gen_array_open (handler); + for (i = 0; i < inst->files_num; i++) + ident_data_to_json (inst->files[i], begin, end, handler); + yajl_gen_array_close (handler); + + return (0); +} /* }}} int inst_data_to_json */ + int inst_describe (graph_config_t *cfg, graph_instance_t *inst, /* {{{ */ char *buffer, size_t buffer_size) { diff --git a/src/graph_instance.h b/src/graph_instance.h index 5a9cd47..0279deb 100644 --- a/src/graph_instance.h +++ b/src/graph_instance.h @@ -29,6 +29,7 @@ #include #include "graph_types.h" +#include "data_provider.h" #include "graph_ident.h" #include "rrd_args.h" #include "utils_array.h" @@ -80,6 +81,9 @@ _Bool inst_matches_field (graph_instance_t *inst, graph_ident_field_t field, const char *field_value); int inst_to_json (const graph_instance_t *inst, yajl_gen handler); +int inst_data_to_json (const graph_instance_t *inst, + dp_time_t begin, dp_time_t end, + yajl_gen handler); int inst_describe (graph_config_t *cfg, graph_instance_t *inst, char *buffer, size_t buffer_size);