Code

store: Renamed a store object's 'children' to 'services'.
authorSebastian Harl <sh@tokkee.org>
Thu, 26 Jun 2014 20:27:31 +0000 (22:27 +0200)
committerSebastian Harl <sh@tokkee.org>
Thu, 26 Jun 2014 20:27:31 +0000 (22:27 +0200)
Hierarchical data will be represented using some object relationship
information rather than a weird tree construct below each host. That's going
to be more flexible.

src/core/store-private.h
src/core/store.c
src/core/store_lookup.c

index 7cc2f66dbffc50363b0c04986a02c4ca66c99360..e501b2cd830169b2b7de01660207c976ca66f089 100644 (file)
@@ -66,7 +66,7 @@ typedef struct {
 typedef struct {
        sdb_store_base_t super;
 
-       sdb_llist_t *children;
+       sdb_llist_t *services;
        sdb_llist_t *attributes;
 } sdb_store_obj_t;
 #define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj))
index df8c02fb152a87135c4f44464476d8d8096d5361..4e642de68042440a13f6b96171048de89f034178 100644 (file)
@@ -92,8 +92,8 @@ sdb_store_obj_init(sdb_object_t *obj, va_list ap)
        if (ret)
                return ret;
 
-       sobj->children = sdb_llist_create();
-       if (! sobj->children)
+       sobj->services = sdb_llist_create();
+       if (! sobj->services)
                return -1;
        sobj->attributes = sdb_llist_create();
        if (! sobj->attributes)
@@ -110,8 +110,8 @@ sdb_store_obj_destroy(sdb_object_t *obj)
 
        store_base_destroy(obj);
 
-       if (sobj->children)
-               sdb_llist_destroy(sobj->children);
+       if (sobj->services)
+               sdb_llist_destroy(sobj->services);
        if (sobj->attributes)
                sdb_llist_destroy(sobj->attributes);
 } /* sdb_store_obj_destroy */
@@ -188,7 +188,7 @@ store_lookup_in_list(sdb_llist_t *l, int type, const char *name)
                if ((type != SDB_HOST) && (STORE_BASE(sobj)->type == SDB_HOST))
                        continue;
 
-               sobj = store_lookup_in_list(sobj->children, type, name);
+               sobj = store_lookup_in_list(sobj->services, type, name);
                if (sobj) {
                        sdb_llist_iter_destroy(iter);
                        return sobj;
@@ -269,7 +269,7 @@ store_obj(int parent_type, const char *parent_name,
                if (type == SDB_ATTRIBUTE)
                        parent_list = parent->attributes;
                else
-                       parent_list = parent->children;
+                       parent_list = parent->services;
        }
 
        if (type == SDB_HOST)
@@ -543,7 +543,7 @@ sdb_store_host_tojson(sdb_store_base_t *h, sdb_strbuf_t *buf, int flags)
 
        if (! (flags & SDB_SKIP_SERVICES)) {
                sdb_strbuf_append(buf, ", \"services\": ");
-               store_obj_tojson(host->children, SDB_SERVICE, buf);
+               store_obj_tojson(host->services, SDB_SERVICE, buf);
        }
 
        sdb_strbuf_append(buf, "}");
index 3920b80127c5a228792b299e06bc5e6e51f1187b..f57cb05cab292fa53d86b56c936d35403fc77351 100644 (file)
@@ -172,7 +172,7 @@ match_name(sdb_store_matcher_t *m, sdb_store_base_t *obj)
                        return match_string(&NAME_M(m)->name, obj->super.name);
                        break;
                case SDB_SERVICE:
-                       iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->children);
+                       iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->services);
                        break;
                case SDB_ATTRIBUTE:
                        iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->attributes);