return path;
}
+int collecty_graph_require_module(collecty_graph* self,
+ collecty_args* args, const char* name, const char* object) {
+ collecty_modules* modules = NULL;
+ collecty_module* module = NULL;
+ int r;
+
+ // Fetch all modules
+ modules = collecty_daemon_get_modules(self->daemon);
+ if (!modules) {
+ r = -ENOTSUP;
+ goto ERROR;
+ }
+
+ // Fetch the module by its name
+ module = collecty_modules_get_by_name(modules, name);
+ if (!module) {
+ ERROR(self->ctx, "Could not find module '%s'\n", name);
+ r = -ENOENT;
+ goto ERROR;
+ }
+
+ // Add the data of the module
+ r = collecty_module_render(module, args, object);
+ if (r < 0)
+ goto ERROR;
+
+ERROR:
+ if (modules)
+ collecty_modules_unref(modules);
+ if (module)
+ collecty_module_unref(module);
+
+ return r;
+}
+
int collecty_graph_render(collecty_graph* self,
const char* object, char** buffer, size_t* length) {
collecty_args* args = NULL;
const char* collecty_graph_get_name(collecty_graph* self);
char* collecty_graph_get_bus_path(collecty_graph* self);
+int collecty_graph_require_module(collecty_graph* self,
+ collecty_args* args, const char* name, const char* object);
+
int collecty_graph_render(collecty_graph* self,
const char* object, char** buffer, size_t* length);
typedef struct collecty_module collecty_module;
+#include "args.h"
#include "ctx.h"
#include "daemon.h"
int collecty_module_commit(collecty_module* self,
const char* object, unsigned int num_samples, const char** samples);
+int collecty_module_render(collecty_module* self,
+ collecty_args* args, const char* object);
+
#endif /* COLLECTY_MODULE_H */