summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28f5b4d)
raw | patch | inline | side by side (parent: 28f5b4d)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 19 Sep 2014 03:24:11 +0000 (20:24 -0700) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 19 Sep 2014 03:24:11 +0000 (20:24 -0700) |
Previously, the reply was {"hosts": [<list>]} while now it's just the list.
This way, the response format matches that of other commands which return host
lists.
This way, the response format matches that of other commands which return host
lists.
src/core/store.c | patch | blob | history | |
t/unit/core/store_test.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 3bc111496ab9a64f5c79a517ccec41e8298f24f2..401780e054bad02bf160bb807a971f02af0808a7 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
return -1;
}
- sdb_strbuf_append(buf, "{\"hosts\":[");
+ sdb_strbuf_append(buf, "[");
len = sdb_strbuf_len(buf);
while (sdb_avltree_iter_has_next(host_iter)) {
return -1;
}
- sdb_strbuf_append(buf, "]}");
+ sdb_strbuf_append(buf, "]");
sdb_avltree_iter_destroy(host_iter);
pthread_rwlock_unlock(&host_lock);
index e8c77c7b04dc0c649fdc7cb0a00985f2fd760354..796c50cb1eddda2c6b030ccfc50ed73b23e3c83c 100644 (file)
--- a/t/unit/core/store_test.c
+++ b/t/unit/core/store_test.c
const char *expected;
} golden_data[] = {
{ { NULL, 0, SDB_DATA_INIT }, 0,
- "{\"hosts\":["
+ "["
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": ["
"\"update_interval\": \"0s\", \"backends\": []}"
"]}"
"]}"
- "]}" },
+ "]" },
{ { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_SERVICES,
- "{\"hosts\":["
+ "["
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": ["
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": [], "
"\"metrics\": []}"
- "]}" },
+ "]" },
{ { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_METRICS,
- "{\"hosts\":["
+ "["
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": ["
"\"update_interval\": \"0s\", \"backends\": []}"
"]}"
"]}"
- "]}" },
+ "]" },
{ { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_ATTRIBUTES,
- "{\"hosts\":["
+ "["
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"metrics\": ["
"\"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": []}"
"]}"
- "]}" },
+ "]" },
{ { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_ALL,
- "{\"hosts\":["
+ "["
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": []},"
"{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": []}"
- "]}" },
+ "]" },
{ { sdb_store_gt_matcher, SDB_FIELD_LAST_UPDATE,
{ SDB_TYPE_DATETIME, { .datetime = 1 } } }, 0,
- "{\"hosts\":["
+ "["
"{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": [], "
"\"update_interval\": \"0s\", \"backends\": []},"
"]}"
"]}"
- "]}" },
+ "]" },
{ { sdb_store_le_matcher, SDB_FIELD_LAST_UPDATE,
{ SDB_TYPE_DATETIME, { .datetime = 1 } } }, 0,
- "{\"hosts\":["
+ "["
"{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": ["
"\"attributes\": []}"
"], "
"\"services\": []}"
- "]}" },
+ "]" },
{ { sdb_store_ge_matcher, SDB_FIELD_LAST_UPDATE,
{ SDB_TYPE_DATETIME, { .datetime = 3 } } }, 0,
- "{\"hosts\":["
+ "["
"{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
"\"update_interval\": \"0s\", \"backends\": [], "
"\"attributes\": [], "
"\"metrics\": [], "
"\"services\": []}"
- "]}" },
+ "]" },
};
buf = sdb_strbuf_create(0);