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