]> arthur.barton.de Git - netdata.git/blob - src/dictionary.h
layout: remove executable from unrelated files
[netdata.git] / src / dictionary.h
1 #include "web_buffer.h"
2
3 #ifndef NETDATA_DICTIONARY_H
4 #define NETDATA_DICTIONARY_H 1
5
6 typedef struct name_value {
7         avl avl;                                // the index - this has to be first!
8
9         uint32_t hash;                  // a simple hash to speed up searching
10                                                         // we first compare hashes, and only if the hashes are equal we do string comparisons
11
12         char *name;
13         char *value;
14
15         struct name_value *next;
16 } NAME_VALUE;
17
18 typedef struct dictionary {
19         NAME_VALUE *values;
20         avl_tree values_index;
21         pthread_rwlock_t rwlock;
22 } DICTIONARY;
23
24 extern DICTIONARY *dictionary_create(void);
25 extern void dictionary_destroy(DICTIONARY *dict);
26 extern void *dictionary_set(DICTIONARY *dict, const char *name, void *value, size_t value_len);
27 extern void *dictionary_get(DICTIONARY *dict, const char *name);
28
29 #endif /* NETDATA_DICTIONARY_H */