diff --git a/src/core/store.c b/src/core/store.c
index b2062831c7447cff2feeea535e9ee325e45e70b1..d6ad01fedd354da89efaa9bac27c6b44921cd180 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
static sdb_avltree_t *
get_host_children(sdb_host_t *host, int type)
{
- assert((type == SDB_SERVICE) || (type == SDB_METRIC)
- || (type == SDB_ATTRIBUTE));
+ if ((type != SDB_SERVICE) && (type != SDB_METRIC)
+ && (type != SDB_ATTRIBUTE))
+ return NULL;
if (! host)
return NULL;
return status;
} /* sdb_store_metric_attr */
+sdb_store_obj_t *
+sdb_store_get_child(sdb_store_obj_t *host, int type, const char *name)
+{
+ sdb_avltree_t *children;
+
+ if ((! host) || (host->type != SDB_HOST) || (! name))
+ return NULL;
+
+ children = get_host_children(HOST(host), type);
+ if (! children)
+ return NULL;
+ return STORE_OBJ(sdb_avltree_lookup(children, name));
+} /* sdb_store_get_child */
+
int
sdb_store_fetch_timeseries(const char *hostname, const char *metric,
sdb_timeseries_opts_t *opts, sdb_strbuf_t *buf)