summaryrefslogtreecommitdiffstats
path: root/src/dictionary.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dictionary.h')
-rwxr-xr-xsrc/dictionary.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/dictionary.h b/src/dictionary.h
new file mode 100755
index 000000000..9822b23c2
--- /dev/null
+++ b/src/dictionary.h
@@ -0,0 +1,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 */