Code

plugin: Drop support for the old timeseries fetcher.
authorSebastian Harl <sh@tokkee.org>
Thu, 8 Sep 2016 04:11:12 +0000 (00:11 -0400)
committerSebastian Harl <sh@tokkee.org>
Thu, 8 Sep 2016 04:11:12 +0000 (00:11 -0400)
src/core/plugin.c
src/include/core/plugin.h

index 8d836cc981de718a9f42cb270ec1b7f8ce66d783..3fb0a77348bb098b414f9724fb9281598ae41463 100644 (file)
@@ -141,7 +141,6 @@ static sdb_llist_t      *collector_list = NULL;
 static sdb_llist_t      *cname_list = NULL;
 static sdb_llist_t      *shutdown_list = NULL;
 static sdb_llist_t      *log_list = NULL;
-static sdb_llist_t      *ts_fetcher_list = NULL;
 static sdb_llist_t      *timeseries_fetcher_list = NULL;
 static sdb_llist_t      *writer_list = NULL;
 static sdb_llist_t      *reader_list = NULL;
@@ -156,7 +155,6 @@ static struct {
        { "cname",              &cname_list },
        { "shutdown",           &shutdown_list },
        { "log",                &log_list },
-       { "timeseries fetcher", &ts_fetcher_list },
        { "timeseries fetcher", &timeseries_fetcher_list },
        { "store writer",       &writer_list },
        { "store reader",       &reader_list },
@@ -1068,14 +1066,6 @@ sdb_plugin_register_collector(const char *name, sdb_plugin_collector_cb callback
        return 0;
 } /* sdb_plugin_register_collector */
 
-int
-sdb_plugin_register_ts_fetcher(const char *name,
-               sdb_plugin_fetch_ts_cb callback, sdb_object_t *user_data)
-{
-       return plugin_add_impl(&ts_fetcher_list, callback_type, "time-series fetcher",
-                       name, callback, user_data);
-} /* sdb_plugin_register_ts_fetcher */
-
 int
 sdb_plugin_register_timeseries_fetcher(const char *name,
                sdb_timeseries_fetcher_t *fetcher, sdb_object_t *user_data)
@@ -1543,9 +1533,6 @@ sdb_timeseries_t *
 sdb_plugin_fetch_timeseries(const char *type, const char *id,
                sdb_timeseries_opts_t *opts)
 {
-       callback_t *plugin;
-       sdb_plugin_fetch_ts_cb callback;
-
        ts_fetcher_t *fetcher;
        sdb_timeseries_t *ts;
 
@@ -1555,25 +1542,15 @@ sdb_plugin_fetch_timeseries(const char *type, const char *id,
                return NULL;
 
        fetcher = TS_FETCHER(sdb_llist_search_by_name(timeseries_fetcher_list, type));
-       if (fetcher) {
-               old_ctx = ctx_set(fetcher->ts_ctx);
-               ts = fetcher->impl.fetch(id, opts, fetcher->ts_user_data);
-               ctx_set(old_ctx);
-               return ts;
-       }
-
-       /* fallback code */
-       plugin = CB(sdb_llist_search_by_name(ts_fetcher_list, type));
-       if (! plugin) {
+       if (! fetcher) {
                sdb_log(SDB_LOG_ERR, "core: Cannot fetch time-series of type %s: "
                                "no such plugin loaded", type);
                errno = ENOENT;
                return NULL;
        }
 
-       old_ctx = ctx_set(plugin->cb_ctx);
-       callback = (sdb_plugin_fetch_ts_cb)plugin->cb_callback;
-       ts = callback(id, opts, plugin->cb_user_data);
+       old_ctx = ctx_set(fetcher->ts_ctx);
+       ts = fetcher->impl.fetch(id, opts, fetcher->ts_user_data);
        ctx_set(old_ctx);
        return ts;
 } /* sdb_plugin_fetch_timeseries */
index 5a26c39fb78b10f503667b9060e4d20f01416746..b12af783adc5f5cb4414496ef0d12704586684e2 100644 (file)
@@ -123,9 +123,6 @@ typedef int (*sdb_plugin_shutdown_cb)(sdb_object_t *user_data);
 typedef int (*sdb_plugin_log_cb)(int prio, const char *msg,
                sdb_object_t *user_data);
 
-typedef sdb_timeseries_t *(*sdb_plugin_fetch_ts_cb)(const char *id,
-               sdb_timeseries_opts_t *opts, sdb_object_t *user_data);
-
 /*
  * sdb_plugin_register_config:
  * Register a "config" function. This will be used to pass on the
@@ -257,9 +254,6 @@ sdb_plugin_register_log(const char *name, sdb_plugin_log_cb callback,
  *    use the object for other purposes, it should thus deref it.
  */
 int
-sdb_plugin_register_ts_fetcher(const char *name,
-               sdb_plugin_fetch_ts_cb callback, sdb_object_t *user_data);
-int
 sdb_plugin_register_timeseries_fetcher(const char *name,
                sdb_timeseries_fetcher_t *fetcher, sdb_object_t *user_data);