mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added new global 'name' setting
This commit is contained in:
parent
28e52c294e
commit
0b5358ed4b
5 changed files with 26 additions and 8 deletions
|
@ -35,6 +35,12 @@ This technique, also called 'pinning', improves the determinism of the server by
|
|||
The `priority` setting allows to adjust the scheduling priority of the deamon processes.
|
||||
By default, the daemon uses a real-time optimized FIFO scheduling algorithm.
|
||||
|
||||
#### `name` *(integer)*
|
||||
|
||||
By default the `name` of a S2SS instance is equalt to the hostname of the machine it is running on.
|
||||
Some node types are using this name to identify themselves agains their remotes.
|
||||
An example is the `ngsi` node type which adds a metadata attribute `source` to its updates.
|
||||
|
||||
## Nodes
|
||||
|
||||
The node section is a **directory** of nodes (clients) which are connected to the S2SS instance.
|
||||
|
|
|
@ -27,6 +27,9 @@ debug = 5; # The level of verbosity for debug messages
|
|||
stats = 3; # The interval in seconds to print path statistics.
|
||||
# A value of 0 disables the statistics.
|
||||
|
||||
name = "s2ss-acs" # The name of this S2SS instance. Might by used by node-types
|
||||
# to identify themselves (default is the hostname).
|
||||
|
||||
|
||||
############ Dictionary of nodes ############
|
||||
|
||||
|
|
|
@ -65,10 +65,11 @@
|
|||
|
||||
/** Global configuration */
|
||||
struct settings {
|
||||
int priority; /**< Process priority (lower is better) */
|
||||
int affinity; /**< Process affinity of the server and all created threads */
|
||||
int debug; /**< Debug log level */
|
||||
double stats; /**< Interval for path statistics. Set to 0 to disable themo disable them. */
|
||||
int priority; /**< Process priority (lower is better) */
|
||||
int affinity; /**< Process affinity of the server and all created threads */
|
||||
int debug; /**< Debug log level */
|
||||
double stats; /**< Interval for path statistics. Set to 0 to disable themo disable them. */
|
||||
const char *name; /**< Name of the S2SS instance */
|
||||
};
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "list.h"
|
||||
|
@ -87,6 +88,11 @@ int config_parse_global(config_setting_t *cfg, struct settings *set)
|
|||
config_setting_lookup_int(cfg, "debug", &set->debug);
|
||||
config_setting_lookup_float(cfg, "stats", &set->stats);
|
||||
|
||||
if (!config_setting_lookup_string(cfg, "name", &set->name)) {
|
||||
set->name = alloc(128); /** @todo missing free */
|
||||
gethostname((char *) set->name, 128);
|
||||
}
|
||||
|
||||
log_setlevel(set->debug);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "ngsi.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern struct settings settings;
|
||||
|
||||
static json_t * json_uuid()
|
||||
{
|
||||
char eid[37];
|
||||
|
@ -181,10 +183,10 @@ void ngsi_prepare_context(struct node *n, config_setting_t *mapping)
|
|||
/* Create Metadata for attribute */
|
||||
json_t *metadatas = json_array();
|
||||
|
||||
json_array_append_new(metadatas, json_pack("{ s: s, s: s, s: s }",
|
||||
"name", "source",
|
||||
"type", "string",
|
||||
"value", "s2ss"
|
||||
json_array_append_new(metadatas, json_pack("{ s: s, s: s, s: s+ }",
|
||||
"name", "source",
|
||||
"type", "string",
|
||||
"value", "s2ss:", settings.name
|
||||
));
|
||||
json_array_append_new(metadatas, json_pack("{ s: s, s: s, s: i }",
|
||||
"name", "index",
|
||||
|
|
Loading…
Add table
Reference in a new issue