Skip to content
Snippets Groups Projects
Commit 759fb007 authored by Steffen Vogel's avatar Steffen Vogel :santa_tone2:
Browse files

node: add new option to skip loading of default hooks

parent 05d37fab
Branches
Tags v0.6.0
No related merge requests found
......@@ -47,6 +47,7 @@ struct node
char *_name; /**< Singleton: A string used to print to screen. */
char *_name_long; /**< Singleton: A string used to print to screen. */
int no_builtin;
int vectorize; /**< Number of messages to send / recv at once (scatter / gather) */
int affinity; /**< CPU Affinity of this node */
int samplelen; /**< The maximum number of values this node can receive. */
......
......@@ -50,6 +50,7 @@ int node_init(struct node *n, struct node_type *vt)
/* Default values */
n->vectorize = 1;
n->no_builtin = 0;
n->samplelen = DEFAULT_SAMPLELEN;
list_push(&vt->instances, n);
......@@ -57,22 +58,24 @@ int node_init(struct node *n, struct node_type *vt)
list_init(&n->hooks);
/* Add internal hooks if they are not already in the list */
for (size_t i = 0; i < list_length(&plugins); i++) {
struct plugin *q = (struct plugin *) list_at(&plugins, i);
if (!n->no_builtin) {
for (size_t i = 0; i < list_length(&plugins); i++) {
struct plugin *q = (struct plugin *) list_at(&plugins, i);
if (q->type != PLUGIN_TYPE_HOOK)
continue;
if (q->type != PLUGIN_TYPE_HOOK)
continue;
struct hook_type *vt = &q->hook;
struct hook_type *vt = &q->hook;
if ((vt->flags & HOOK_NODE) && (vt->flags & HOOK_BUILTIN)) {
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
if ((vt->flags & HOOK_NODE) && (vt->flags & HOOK_BUILTIN)) {
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
ret = hook_init(h, vt, NULL, n);
if (ret)
return ret;
ret = hook_init(h, vt, NULL, n);
if (ret)
return ret;
list_push(&n->hooks, h);
list_push(&n->hooks, h);
}
}
}
......@@ -101,11 +104,12 @@ int node_parse(struct node *n, json_t *cfg, const char *name)
n->name = strdup(name);
ret = json_unpack_ex(cfg, &err, 0, "{ s: s, s?: i, s?: i, s?: o }",
ret = json_unpack_ex(cfg, &err, 0, "{ s: s, s?: i, s?: i, s?: o, s?: b }",
"type", &type,
"vectorize", &n->vectorize,
"samplelen", &n->samplelen,
"hooks", &json_hooks
"hooks", &json_hooks,
"no_builtin", &n->no_builtin
);
if (ret)
jerror(&err, "Failed to parse node '%s'", node_name(n));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment