From: Sebastian Harl Date: Wed, 5 Nov 2014 23:28:00 +0000 (+0100) Subject: store_lookup: Let the iter operators support services and metrics. X-Git-Tag: sysdb-0.6.0~24 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=f47d818c0185b28f69366e8e98b432f394ec184a store_lookup: Let the iter operators support services and metrics. --- diff --git a/src/core/store_lookup.c b/src/core/store_lookup.c index 94459cb..ffa1346 100644 --- a/src/core/store_lookup.c +++ b/src/core/store_lookup.c @@ -93,16 +93,20 @@ match_iter(sdb_store_matcher_t *m, sdb_store_obj_t *obj, assert((m->type == MATCHER_ANY) || (m->type == MATCHER_ALL)); - /* TODO: support all object types */ - if (obj->type != SDB_HOST) - return 0; - - if (ITER_M(m)->type == SDB_SERVICE) - iter = sdb_avltree_get_iter(HOST(obj)->services); - else if (ITER_M(m)->type == SDB_METRIC) - iter = sdb_avltree_get_iter(HOST(obj)->metrics); - else if (ITER_M(m)->type == SDB_ATTRIBUTE) - iter = sdb_avltree_get_iter(HOST(obj)->attributes); + if (obj->type == SDB_HOST) { + if (ITER_M(m)->type == SDB_SERVICE) + iter = sdb_avltree_get_iter(HOST(obj)->services); + else if (ITER_M(m)->type == SDB_METRIC) + iter = sdb_avltree_get_iter(HOST(obj)->metrics); + else if (ITER_M(m)->type == SDB_ATTRIBUTE) + iter = sdb_avltree_get_iter(HOST(obj)->attributes); + } else if (obj->type == SDB_SERVICE) { + if (ITER_M(m)->type == SDB_ATTRIBUTE) + iter = sdb_avltree_get_iter(SVC(obj)->attributes); + } else if (obj->type == SDB_METRIC) { + if (ITER_M(m)->type == SDB_ATTRIBUTE) + iter = sdb_avltree_get_iter(METRIC(obj)->attributes); + } status = all; while (sdb_avltree_iter_has_next(iter)) {