master
h 92 lines 2.75 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_RRDSET_INDEX_ID_H
4 #define NETDATA_RRDSET_INDEX_ID_H
5
6 #include "rrd.h"
7
8 RRDSET *rrdset_create_custom(
9 RRDHOST *host
10 , const char *type
11 , const char *id
12 , const char *name
13 , const char *family
14 , const char *context
15 , const char *title
16 , const char *units
17 , const char *plugin
18 , const char *module
19 , long priority
20 , int update_every
21 , RRDSET_TYPE chart_type
22 ,
23 RRD_DB_MODE memory_mode
24 , long history_entries
25 );
26
27 static inline
28 RRDSET *rrdset_create(RRDHOST *host
29 , const char *type
30 , const char *id
31 , const char *name
32 , const char *family
33 , const char *context
34 , const char *title
35 , const char *units
36 , const char *plugin
37 , const char *module
38 , long priority
39 , int update_every
40 , RRDSET_TYPE chart_type) {
41 return rrdset_create_custom(
42 host, type, id, name, family, context, title, units, plugin, module, priority, update_every, chart_type, (host)->rrd_memory_mode, (host)->rrd_history_entries);
43 }
44
45 static inline
46 RRDSET *rrdset_create_localhost(
47 const char *type
48 , const char *id
49 , const char *name
50 , const char *family
51 , const char *context
52 , const char *title
53 , const char *units
54 , const char *plugin
55 , const char *module
56 , long priority
57 , int update_every
58 , RRDSET_TYPE chart_type) {
59 return rrdset_create(
60 localhost, type, id, name, family, context, title, units, plugin, module, priority, update_every, chart_type);
61 }
62
63 void rrdset_index_init(RRDHOST *host);
64 void rrdset_index_destroy(RRDHOST *host);
65
66 void rrdset_free(RRDSET *st);
67
68 RRDSET *rrdset_find(RRDHOST *host, const char *id, bool include_obsolete);
69 RRDSET *rrdset_find_bytype(RRDHOST *host, const char *type, const char *id, bool include_obsolete);
70
71 RRDSET_ACQUIRED *rrdset_find_and_acquire(RRDHOST *host, const char *id, bool include_obsolete);
72
73 void rrdset_acquired_release(RRDSET_ACQUIRED *rsa);
74 RRDSET *rrdset_acquired_to_rrdset(RRDSET_ACQUIRED *rsa);
75
76 uint16_t rrddim_collection_modulo(RRDSET *st, uint32_t spread);
77
78 /* This will not return charts that are obsolete */
79 ALWAYS_INLINE
80 static RRDSET *rrdset_find_active_localhost(const char *id) {
81 RRDSET *st = rrdset_find(localhost, id, false);
82 return st;
83 }
84
85 /* This will not return charts that are obsolete */
86 ALWAYS_INLINE
87 static RRDSET *rrdset_find_active_bytype_localhost(const char *type, const char *id) {
88 RRDSET *st = rrdset_find_bytype(localhost, type, id, false);
89 return st;
90 }
91
92 #endif //NETDATA_RRDSET_INDEX_ID_H