@cryptotaxi247 / netdata-1 / commits / 6e33f0487

ACLK fix error for older compilers (#10470)

* organizes code better and fixes error with older C compilers

Timotej S committed Jan 11, 2021 at 09:01 UTC 6e33f048734e2b279f43926515aa343025a8b807
5 files changed +47 -40
CMakeLists.txt
+1
@@ -713,6 +713,7 @@ set(BACKENDS_PLUGIN_FILES
713 set(CLAIM_PLUGIN_FILES
714 claim/claim.c
715 claim/claim.h
716 + aclk/aclk_rrdhost_state.h
717 aclk/aclk_common.c
718 aclk/aclk_common.h
719 )
Makefile.am
+1
@@ -524,6 +524,7 @@ PARSER_FILES = \
524 $(NULL)
525
526 ACLK_FILES = \
527 + aclk/aclk_rrdhost_state.h \
528 aclk/aclk_common.c \
529 aclk/aclk_common.h \
530 aclk/aclk_stats.c \
aclk/aclk_common.h
+2 -39
@@ -1,7 +1,8 @@
1 #ifndef ACLK_COMMON_H
2 #define ACLK_COMMON_H
3
4 -#include "libnetdata/libnetdata.h"
4 +#include "aclk_rrdhost_state.h"
5 +#include "../daemon/common.h"
6
7 extern netdata_mutex_t aclk_shared_state_mutex;
8 #define ACLK_SHARED_STATE_LOCK netdata_mutex_lock(&aclk_shared_state_mutex)
@@ -29,47 +30,9 @@ extern netdata_mutex_t aclk_shared_state_mutex;
30 #define ACLK_V_COMPRESSION 2
31 #define ACLK_V_CHILDRENSTATE 3
32
32 -typedef enum aclk_cmd {
33 - ACLK_CMD_CLOUD,
34 - ACLK_CMD_ONCONNECT,
35 - ACLK_CMD_INFO,
36 - ACLK_CMD_CHART,
37 - ACLK_CMD_CHARTDEL,
38 - ACLK_CMD_ALARM,
39 - ACLK_CMD_CLOUD_QUERY_2,
40 - ACLK_CMD_CHILD_CONNECT,
41 - ACLK_CMD_CHILD_DISCONNECT
42 -} ACLK_CMD;
43 -
44 -typedef enum aclk_metadata_state {
45 - ACLK_METADATA_REQUIRED,
46 - ACLK_METADATA_CMD_QUEUED,
47 - ACLK_METADATA_SENT
48 -} ACLK_METADATA_STATE;
49 -
50 -typedef enum aclk_agent_state {
51 - ACLK_HOST_INITIALIZING,
52 - ACLK_HOST_STABLE
53 -} ACLK_POPCORNING_STATE;
54 -
55 -typedef struct aclk_rrdhost_state {
56 - char *claimed_id; // Claimed ID if host has one otherwise NULL
57 -
58 -#ifdef ENABLE_ACLK
59 - // per child popcorning
60 - ACLK_POPCORNING_STATE state;
61 - ACLK_METADATA_STATE metadata;
62 -
63 - time_t timestamp_created;
64 - time_t t_last_popcorn_update;
65 -#endif
66 -} aclk_rrdhost_state;
67 -
33 #define ACLK_IS_HOST_INITIALIZING(host) (host->aclk_state.state == ACLK_HOST_INITIALIZING)
34 #define ACLK_IS_HOST_POPCORNING(host) (ACLK_IS_HOST_INITIALIZING(host) && host->aclk_state.t_last_popcorn_update)
35
71 -typedef struct rrdhost RRDHOST;
72 -
36 extern struct aclk_shared_state {
37 // optimization to avoid looping trough hosts
38 // every time Query Thread wakes up
aclk/aclk_rrdhost_state.h new
+42
@@ -0,0 +1,42 @@
1 +#ifndef ACLK_RRDHOST_STATE_H
2 +#define ACLK_RRDHOST_STATE_H
3 +
4 +#include "../libnetdata/libnetdata.h"
5 +
6 +typedef enum aclk_cmd {
7 + ACLK_CMD_CLOUD,
8 + ACLK_CMD_ONCONNECT,
9 + ACLK_CMD_INFO,
10 + ACLK_CMD_CHART,
11 + ACLK_CMD_CHARTDEL,
12 + ACLK_CMD_ALARM,
13 + ACLK_CMD_CLOUD_QUERY_2,
14 + ACLK_CMD_CHILD_CONNECT,
15 + ACLK_CMD_CHILD_DISCONNECT
16 +} ACLK_CMD;
17 +
18 +typedef enum aclk_metadata_state {
19 + ACLK_METADATA_REQUIRED,
20 + ACLK_METADATA_CMD_QUEUED,
21 + ACLK_METADATA_SENT
22 +} ACLK_METADATA_STATE;
23 +
24 +typedef enum aclk_agent_state {
25 + ACLK_HOST_INITIALIZING,
26 + ACLK_HOST_STABLE
27 +} ACLK_POPCORNING_STATE;
28 +
29 +typedef struct aclk_rrdhost_state {
30 + char *claimed_id; // Claimed ID if host has one otherwise NULL
31 +
32 +#ifdef ENABLE_ACLK
33 + // per child popcorning
34 + ACLK_POPCORNING_STATE state;
35 + ACLK_METADATA_STATE metadata;
36 +
37 + time_t timestamp_created;
38 + time_t t_last_popcorn_update;
39 +#endif /* ENABLE_ACLK */
40 +} aclk_rrdhost_state;
41 +
42 +#endif /* ACLK_RRDHOST_STATE_H */
database/rrd.h
+1 -1
@@ -34,7 +34,7 @@ struct pg_cache_page_index;
34 #include "rrdcalc.h"
35 #include "rrdcalctemplate.h"
36 #include "../streaming/rrdpush.h"
37 -#include "../aclk/aclk_common.h"
37 +#include "../aclk/aclk_rrdhost_state.h"
38
39 struct context_param {
40 RRDDIM *rd;