Code

store: Removed now unused tojson functions.
authorSebastian Harl <sh@tokkee.org>
Mon, 3 Nov 2014 06:43:20 +0000 (07:43 +0100)
committerSebastian Harl <sh@tokkee.org>
Mon, 3 Nov 2014 06:43:20 +0000 (07:43 +0100)
src/core/store.c
src/include/core/store.h
src/include/frontend/connection.h
t/unit/core/store_test.c

index 52328f8cf4ad6aa89b8039e0e7b2372babaa2a40..b2062831c7447cff2feeea535e9ee325e45e70b1 100644 (file)
@@ -440,109 +440,6 @@ get_host_children(sdb_host_t *host, int type)
                return host->services;
 } /* get_host_children */
 
-/*
- * store_common_tojson serializes common object attributes to JSON.
- *
- * The function never returns an error. Rather, an error message will be part
- * of the serialized data.
- */
-static void
-store_common_tojson(sdb_store_obj_t *obj, sdb_strbuf_t *buf)
-{
-       char time_str[64];
-       char interval_str[64];
-       size_t i;
-
-       /* TODO: make time and interval formats configurable */
-       if (! sdb_strftime(time_str, sizeof(time_str),
-                               "%F %T %z", obj->last_update))
-               snprintf(time_str, sizeof(time_str), "<error>");
-       time_str[sizeof(time_str) - 1] = '\0';
-
-       if (! sdb_strfinterval(interval_str, sizeof(interval_str),
-                               obj->interval))
-               snprintf(interval_str, sizeof(interval_str), "<error>");
-       interval_str[sizeof(interval_str) - 1] = '\0';
-
-       sdb_strbuf_append(buf, "\"last_update\": \"%s\", "
-                       "\"update_interval\": \"%s\", \"backends\": [",
-                       time_str, interval_str);
-
-       for (i = 0; i < obj->backends_num; ++i) {
-               sdb_strbuf_append(buf, "\"%s\"", obj->backends[i]);
-               if (i < obj->backends_num - 1)
-                       sdb_strbuf_append(buf, ",");
-       }
-       sdb_strbuf_append(buf, "]");
-} /* store_common_tojson */
-
-/*
- * store_obj_tojson serializes attribute / metric / service objects to JSON.
- *
- * The function never returns an error. Rather, an error message will be part
- * of the serialized data.
- */
-static void
-store_obj_tojson(sdb_avltree_t *tree, int type, sdb_strbuf_t *buf,
-               sdb_store_matcher_t *filter, int flags)
-{
-       sdb_avltree_iter_t *iter;
-
-       assert((type == SDB_ATTRIBUTE)
-                       || (type == SDB_METRIC)
-                       || (type == SDB_SERVICE));
-
-       sdb_strbuf_append(buf, "[");
-       iter = sdb_avltree_get_iter(tree);
-       if (! iter) {
-               char errbuf[1024];
-               sdb_log(SDB_LOG_ERR, "store: Failed to retrieve %ss: %s\n",
-                               SDB_STORE_TYPE_TO_NAME(type),
-                               sdb_strerror(errno, errbuf, sizeof(errbuf)));
-               sdb_strbuf_append(buf, "{\"error\": \"failed to retrieve %ss: %s\"}",
-                               SDB_STORE_TYPE_TO_NAME(type), errbuf);
-       }
-
-       /* has_next returns false if the iterator is NULL */
-       while (sdb_avltree_iter_has_next(iter)) {
-               sdb_store_obj_t *sobj = STORE_OBJ(sdb_avltree_iter_get_next(iter));
-               assert(sobj);
-               assert(sobj->type == type);
-
-               if (filter && (! sdb_store_matcher_matches(filter, sobj, NULL)))
-                       continue;
-
-               sdb_strbuf_append(buf, "{\"name\": \"%s\", ", SDB_OBJ(sobj)->name);
-               if (sobj->type == SDB_ATTRIBUTE) {
-                       char tmp[sdb_data_strlen(&ATTR(sobj)->value) + 1];
-                       sdb_data_format(&ATTR(sobj)->value, tmp, sizeof(tmp),
-                                       SDB_DOUBLE_QUOTED);
-                       sdb_strbuf_append(buf, "\"value\": %s, ", tmp);
-               }
-               store_common_tojson(sobj, buf);
-
-               if ((sobj->type == SDB_SERVICE)
-                               && (! (flags & SDB_SKIP_ATTRIBUTES))) {
-                       sdb_strbuf_append(buf, ", \"attributes\": ");
-                       store_obj_tojson(SVC(sobj)->attributes, SDB_ATTRIBUTE,
-                                       buf, filter, flags);
-               }
-               else if ((sobj->type == SDB_METRIC)
-                               && (! (flags & SDB_SKIP_ATTRIBUTES))) {
-                       sdb_strbuf_append(buf, ", \"attributes\": ");
-                       store_obj_tojson(METRIC(sobj)->attributes, SDB_ATTRIBUTE,
-                                       buf, filter, flags);
-               }
-               sdb_strbuf_append(buf, "}");
-
-               if (sdb_avltree_iter_has_next(iter))
-                       sdb_strbuf_append(buf, ",");
-       }
-
-       sdb_avltree_iter_destroy(iter);
-       sdb_strbuf_append(buf, "]");
-} /* store_obj_tojson */
-
 /*
  * ts_tojson serializes a time-series to JSON.
  *
@@ -1007,118 +904,6 @@ sdb_store_get_attr(sdb_store_obj_t *obj, const char *name, sdb_data_t *res,
        return 0;
 } /* sdb_store_get_attr */
 
-int
-sdb_store_host_tojson(sdb_store_obj_t *h, sdb_strbuf_t *buf,
-               sdb_store_matcher_t *filter, int flags)
-{
-       sdb_host_t *host = HOST(h);
-
-       if ((! h) || (h->type != SDB_HOST) || (! buf))
-               return -1;
-
-       /* This function ignores SKIP_EMPTY flags given that the current
-        * implementation sucks and it's nut currently used when calling this
-        * function directly. */
-
-       sdb_strbuf_append(buf, "{\"name\": \"%s\", ", SDB_OBJ(host)->name);
-       store_common_tojson(h, buf);
-
-       if (! (flags & SDB_SKIP_ATTRIBUTES)) {
-               sdb_strbuf_append(buf, ", \"attributes\": ");
-               store_obj_tojson(host->attributes, SDB_ATTRIBUTE, buf, filter, flags);
-       }
-
-       if (! (flags & SDB_SKIP_METRICS)) {
-               sdb_strbuf_append(buf, ", \"metrics\": ");
-               store_obj_tojson(host->metrics, SDB_METRIC, buf, filter, flags);
-       }
-
-       if (! (flags & SDB_SKIP_SERVICES)) {
-               sdb_strbuf_append(buf, ", \"services\": ");
-               store_obj_tojson(host->services, SDB_SERVICE, buf, filter, flags);
-       }
-
-       sdb_strbuf_append(buf, "}");
-       return 0;
-} /* sdb_store_host_tojson */
-
-static _Bool
-has_children(sdb_avltree_t *tree, sdb_store_matcher_t *filter)
-{
-       sdb_avltree_iter_t *iter;
-
-       if (! filter)
-               return sdb_avltree_size(tree) > 0;
-
-       iter = sdb_avltree_get_iter(tree);
-       while (sdb_avltree_iter_has_next(iter)) {
-               sdb_store_obj_t *sobj = STORE_OBJ(sdb_avltree_iter_get_next(iter));
-               if (sdb_store_matcher_matches(filter, sobj, NULL)) {
-                       sdb_avltree_iter_destroy(iter);
-                       return 1;
-               }
-       }
-       sdb_avltree_iter_destroy(iter);
-       return 0;
-} /* has_children */
-
-int
-sdb_store_tojson(sdb_strbuf_t *buf, sdb_store_matcher_t *filter, int flags)
-{
-       sdb_avltree_iter_t *host_iter;
-       size_t len;
-
-       if (! buf)
-               return -1;
-
-       pthread_rwlock_rdlock(&host_lock);
-
-       host_iter = sdb_avltree_get_iter(hosts);
-       if (! host_iter) {
-               pthread_rwlock_unlock(&host_lock);
-               return -1;
-       }
-
-       sdb_strbuf_append(buf, "[");
-
-       len = sdb_strbuf_len(buf);
-       while (sdb_avltree_iter_has_next(host_iter)) {
-               sdb_store_obj_t *host;
-
-               host = STORE_OBJ(sdb_avltree_iter_get_next(host_iter));
-               assert(host);
-
-               if (filter && (! sdb_store_matcher_matches(filter, host, NULL)))
-                       continue;
-
-               /*
-                * XXX: This approach sucks but it's the best we can do at the moment.
-                * In the future, all store lookups should be split into multiple
-                * steps instead: first, retrieve all relevant objects and apply all
-                * pre-processing operations and then format it for the wire.
-                */
-               if ((flags & SDB_SKIP_EMPTY_SERVICES)
-                               && (! has_children(HOST(host)->services, filter)))
-                       continue;
-               if ((flags & SDB_SKIP_EMPTY_METRICS)
-                               && (! has_children(HOST(host)->metrics, filter)))
-                       continue;
-
-               if (sdb_strbuf_len(buf) > len)
-                       sdb_strbuf_append(buf, ",");
-               len = sdb_strbuf_len(buf);
-
-               if (sdb_store_host_tojson(host, buf, filter, flags))
-                       return -1;
-       }
-
-       sdb_strbuf_append(buf, "]");
-
-       sdb_avltree_iter_destroy(host_iter);
-       pthread_rwlock_unlock(&host_lock);
-       return 0;
-} /* sdb_store_tojson */
-
 int
 sdb_store_scan(int type, sdb_store_matcher_t *m, sdb_store_matcher_t *filter,
                sdb_store_lookup_cb cb, void *user_data)
index c25c278a327f5904ec8252cdee65ac9dc3da15d8..9bb75948d76e76c759568dda46860b67f179ade7 100644 (file)
@@ -570,57 +570,12 @@ sdb_store_scan(int type, sdb_store_matcher_t *m, sdb_store_matcher_t *filter,
                sdb_store_lookup_cb cb, void *user_data);
 
 /*
- * Flags for serialization functions.
- *
- * By default, the full host object will be included in the serialized output.
- * When specifying any of the flags, the respective information will be left
- * out. The SKIP_EMPTY flags may be used to skip host objects entirely.
+ * Flags for JSON formatting.
  */
 enum {
-       SDB_WANT_ARRAY              = 1 << 0,
-
-       SDB_SKIP_ATTRIBUTES         = 1 << 0,
-       SDB_SKIP_SERVICES           = 1 << 1,
-       SDB_SKIP_METRICS            = 1 << 2,
-       SDB_SKIP_SERVICE_ATTRIBUTES = 1 << 3,
-
-       SDB_SKIP_ALL                = (1 << 8) - 1,
-
-       /* skip hosts if they do not reference any services/metrics */
-       SDB_SKIP_EMPTY_SERVICES     = 1 << 8,
-       SDB_SKIP_EMPTY_METRICS      = 1 << 9,
+       SDB_WANT_ARRAY = 1 << 0,
 };
 
-/*
- * sdb_store_tojson:
- * Serialize the entire store to JSON and append the result to the specified
- * buffer. If specified, only objects matching the filter will be included in
- * the result (see sdb_store_host_tojson for details).
- *
- * Returns:
- *  - 0 on success
- *  - a negative value on error
- */
-int
-sdb_store_tojson(sdb_strbuf_t *buf, sdb_store_matcher_t *filter, int flags);
-
-/*
- * sdb_store_host_tojson:
- * Serialize a host object to JSON and append the result to the specified
- * buffer. If specified, only objects matching the filter will be included in
- * the result. The filter is applied to each object individually and, thus,
- * should not be of any object-type specific kind. The filter is never applied
- * to the specified host object; the caller is responsible for this and for
- * correctly handling skipped hosts.
- *
- * Returns:
- *  - 0 on success
- *  - a negative value on error
- */
-int
-sdb_store_host_tojson(sdb_store_obj_t *host, sdb_strbuf_t *buf,
-               sdb_store_matcher_t *filter, int flags);
-
 /*
  * sdb_store_json_formatter:
  * Create a JSON formatter for the specified object types writing to the
index a890bd0ffae75d16fa1e39909c12fb5c0621d86b..efa8ba437278ab5aaa85ee72f9fdceaf883bf374 100644 (file)
@@ -188,7 +188,7 @@ sdb_fe_lookup(sdb_conn_t *conn);
  * sdb_fe_exec_fetch:
  * Execute the 'FETCH' command. Send the named object of the specified type,
  * serialized as JSON, to the client. If specified, only objects matching the
- * filter will be included. See sdb_store_tojson for details.
+ * filter will be included.
  *
  * Returns:
  *  - 0 on success
@@ -203,7 +203,7 @@ sdb_fe_exec_fetch(sdb_conn_t *conn, int type, const char *name,
  * Execute the 'LIST' command. Send a complete listing of the store,
  * serialized as JSON, to the client. The listing includes all hosts and the
  * specified object type. If specified, only objects matching the filter will
- * be included. See sdb_store_tojson for details.
+ * be included.
  *
  * Returns:
  *  - 0 on success
@@ -216,7 +216,7 @@ sdb_fe_exec_list(sdb_conn_t *conn, int type, sdb_store_matcher_t *filter);
  * sdb_fe_exec_lookup:
  * Execute the 'LOOKUP' command. Send a list of objects of the specified type
  * matching 'm', serialized as JSON, to the client. If specified, only objects
- * matching the filter will be included. See sdb_store_tojson for details.
+ * matching the filter will be included.
  *
  * Returns:
  *  - 0 on success
index 1c1eac440d6f7f4d63ebbe973f35beeae35c4227..ab3087acbc2cbe2101f1c877737048273e1c19b2 100644 (file)
@@ -407,315 +407,6 @@ START_TEST(test_store_service_attr)
 }
 END_TEST
 
-static void
-verify_json_output(sdb_strbuf_t *buf, const char *expected,
-               sdb_store_matcher_t *filter, int flags)
-{
-       int pos;
-       size_t len1, len2;
-       size_t i;
-
-       len1 = strlen(sdb_strbuf_string(buf));
-       len2 = strlen(expected);
-
-       pos = -1;
-       if (len1 != len2)
-               pos = (int)(len1 <= len2 ? len1 : len2);
-
-       for (i = 0; i < (len1 <= len2 ? len1 : len2); ++i) {
-               if (sdb_strbuf_string(buf)[i] != expected[i]) {
-                       pos = (int)i;
-                       break;
-               }
-       }
-
-       fail_unless(pos == -1,
-                       "sdb_store_tojson(<buf>, %p, %x) returned unexpected result\n"
-                       "         got: %s\n              %*s\n    expected: %s",
-                       filter, flags, sdb_strbuf_string(buf), pos + 1, "^",
-                       expected);
-} /* verify_json_output */
-
-START_TEST(test_store_tojson)
-{
-       sdb_strbuf_t *buf;
-       size_t i;
-
-       struct {
-               struct {
-                       sdb_store_matcher_t *(*m)(sdb_store_expr_t *,
-                                       sdb_store_expr_t *);
-                       int field;
-                       sdb_data_t value;
-               } filter;
-               int flags;
-               const char *expected;
-       } golden_data[] = {
-               { { NULL, 0, SDB_DATA_INIT }, 0,
-                       "["
-                               "{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": ["
-                                               "{\"name\": \"k1\", \"value\": \"v1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"k2\", \"value\": \"v2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"k3\", \"value\": \"v3\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                       "], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": ["
-                                                               "{\"name\": \"k3\", \"value\": 42, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                                       "]},"
-                                               "{\"name\": \"m2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []}"
-                                       "], "
-                                       "\"services\": []},"
-                               "{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": [], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []}"
-                                       "], "
-                                       "\"services\": ["
-                                               "{\"name\": \"s1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []},"
-                                               "{\"name\": \"s2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": ["
-                                                               "{\"name\": \"k1\", \"value\": 123, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                                               "{\"name\": \"k2\", \"value\": 4711, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                                       "]}"
-                                       "]}"
-                       "]" },
-               { { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_SERVICES,
-                       "["
-                               "{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": ["
-                                               "{\"name\": \"k1\", \"value\": \"v1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"k2\", \"value\": \"v2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"k3\", \"value\": \"v3\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                       "], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": ["
-                                                               "{\"name\": \"k3\", \"value\": 42, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                                       "]},"
-                                               "{\"name\": \"m2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []}"
-                                       "]},"
-                               "{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": [], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []}"
-                                       "]}"
-                       "]" },
-               { { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_METRICS,
-                       "["
-                               "{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": ["
-                                               "{\"name\": \"k1\", \"value\": \"v1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"k2\", \"value\": \"v2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"k3\", \"value\": \"v3\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                       "], "
-                                       "\"services\": []},"
-                               "{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": [], "
-                                       "\"services\": ["
-                                               "{\"name\": \"s1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []},"
-                                               "{\"name\": \"s2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": ["
-                                                               "{\"name\": \"k1\", \"value\": 123, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                                               "{\"name\": \"k2\", \"value\": 4711, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                                       "]}"
-                                       "]}"
-                       "]" },
-               { { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_ATTRIBUTES,
-                       "["
-                               "{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"m2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                       "], "
-                                       "\"services\": []},"
-                               "{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                       "], "
-                                       "\"services\": ["
-                                               "{\"name\": \"s1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                               "{\"name\": \"s2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []}"
-                                       "]}"
-                       "]" },
-               { { NULL, 0, SDB_DATA_INIT }, SDB_SKIP_ALL,
-                       "["
-                               "{\"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_eq_matcher, SDB_FIELD_NAME,
-                               { SDB_TYPE_STRING, { .string = "h1" } } }, 0,
-                       "["
-                               "{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": [], \"metrics\": [], \"services\": []}"
-                       "]" },
-               { { sdb_store_gt_matcher, SDB_FIELD_LAST_UPDATE,
-                               { SDB_TYPE_DATETIME, { .datetime = 1 } } }, 0,
-                       "["
-                               "{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": [], "
-                                       "\"metrics\": [], "
-                                       "\"services\": ["
-                                               "{\"name\": \"s2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": ["
-                                                               "{\"name\": \"k1\", \"value\": 123, "
-                                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                                       "]}"
-                                       "]}"
-                       "]" },
-               { { sdb_store_le_matcher, SDB_FIELD_LAST_UPDATE,
-                               { SDB_TYPE_DATETIME, { .datetime = 1 } } }, 0,
-                       "["
-                               "{\"name\": \"h1\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": ["
-                                               "{\"name\": \"k1\", \"value\": \"v1\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": []},"
-                                       "], "
-                                       "\"metrics\": ["
-                                               "{\"name\": \"m2\", "
-                                                       "\"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                                       "\"attributes\": []}"
-                                       "], "
-                                       "\"services\": []}"
-                       "]" },
-               { { sdb_store_ge_matcher, SDB_FIELD_LAST_UPDATE,
-                               { SDB_TYPE_DATETIME, { .datetime = 3 } } }, 0,
-                       "["
-                               "{\"name\": \"h2\", \"last_update\": \"1970-01-01 00:00:00 +0000\", "
-                                       "\"update_interval\": \"0s\", \"backends\": [], "
-                                       "\"attributes\": [], "
-                                       "\"metrics\": [], "
-                                       "\"services\": []}"
-                       "]" },
-       };
-
-       buf = sdb_strbuf_create(0);
-       fail_unless(buf != NULL, "INTERNAL ERROR: failed to create string buffer");
-       populate();
-
-       for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) {
-               sdb_store_matcher_t *filter = NULL;
-               int status;
-
-               sdb_strbuf_clear(buf);
-
-               if (golden_data[i].filter.m) {
-                       sdb_store_expr_t *field;
-                       sdb_store_expr_t *value;
-
-                       field = sdb_store_expr_fieldvalue(golden_data[i].filter.field);
-                       fail_unless(field != NULL,
-                                       "INTERNAL ERROR: sdb_store_expr_fieldvalue() = NULL");
-                       value = sdb_store_expr_constvalue(&golden_data[i].filter.value);
-                       fail_unless(value != NULL,
-                                       "INTERNAL ERROR: sdb_store_expr_constvalue() = NULL");
-
-                       filter = golden_data[i].filter.m(field, value);
-                       fail_unless(filter != NULL,
-                                       "INTERNAL ERROR: sdb_store_*_matcher() = NULL");
-
-                       sdb_object_deref(SDB_OBJ(field));
-                       sdb_object_deref(SDB_OBJ(value));
-               }
-
-               status = sdb_store_tojson(buf, filter, golden_data[i].flags);
-               fail_unless(status == 0,
-                               "sdb_store_tojson(<buf>, %p, %x) = %d; expected: 0",
-                               filter, golden_data[i].flags, status);
-
-               verify_json_output(buf, golden_data[i].expected,
-                               filter, golden_data[i].flags);
-               sdb_object_deref(SDB_OBJ(filter));
-       }
-       sdb_strbuf_destroy(buf);
-}
-END_TEST
-
 START_TEST(test_get_field)
 {
        sdb_store_obj_t *host;
@@ -964,7 +655,6 @@ core_store_suite(void)
        TCase *tc;
 
        tc = tcase_create("core");
-       tcase_add_test(tc, test_store_tojson);
        tcase_add_test(tc, test_store_host);
        tcase_add_test(tc, test_store_get_host);
        tcase_add_test(tc, test_store_attr);