1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

moved node id field to struct node::id

This commit is contained in:
Steffen Vogel 2017-04-02 12:59:56 +02:00
parent 1c869e49a7
commit 57329bfa92
5 changed files with 9 additions and 7 deletions

View file

@ -34,6 +34,8 @@ struct node
int vectorize; /**< Number of messages to send / recv at once (scatter / gather) */
int affinity; /**< CPU Affinity of this node */
int id; /**< An id of this node which is only unique in the scope of it's super-node (VILLASnode instance). */
unsigned long sequence; /**< This is a counter of received samples, in case the node-type does not generate sequence numbers itself. */

View file

@ -33,7 +33,6 @@ struct websocket {
struct pool pool;
struct queue queue; /**< For samples which are received from WebSockets a */
int id; /**< The index of this node */
};
/* Internal datastructures */

View file

@ -26,7 +26,8 @@ static int api_nodes(struct api_ressource *r, json_t *args, json_t **resp, struc
"name", node_name_short(n),
"state", n->state,
"vectorize", n->vectorize,
"affinity", n->affinity
"affinity", n->affinity,
"id", i
);
/* Add all additional fields of node here.

View file

@ -15,11 +15,15 @@
int node_init(struct node *n, struct node_type *vt)
{
static int max_id;
assert(n->state == STATE_DESTROYED);
n->_vt = vt;
n->_vd = alloc(vt->size);
n->id = max_id++;
/* Default values */
n->vectorize = 1;

View file

@ -22,8 +22,6 @@
#include "nodes/websocket.h"
/* Private static storage */
static int id = 0; /**< Highest assigned ID to websocket nodes. */
struct list connections; /**< List of active libwebsocket connections which receive samples from all nodes (catch all) */
/* Forward declarations */
@ -122,7 +120,7 @@ static int websocket_connection_write(struct websocket_connection *c, struct sam
msg->endian = WEBMSG_ENDIAN_HOST;
msg->length = smps[i]->length;
msg->sequence = smps[i]->sequence;
msg->id = w->id;
msg->id = c->node->id;
msg->ts.sec = smps[i]->ts.origin.tv_sec;
msg->ts.nsec = smps[i]->ts.origin.tv_nsec;
@ -263,8 +261,6 @@ int websocket_start(struct node *n)
int ret;
struct websocket *w = n->_vd;
w->id = id++;
size_t blocklen = LWS_PRE + WEBMSG_LEN(DEFAULT_VALUES);
ret = pool_init(&w->pool, 64 * DEFAULT_QUEUELEN, blocklen, &memtype_hugepage);