diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2016-03-30 21:40:42 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2016-03-30 21:40:42 +0000 |
commit | 9ce153ce7167c11adba8ac225edc7a707e97c6eb (patch) | |
tree | 9f6e849cce2dcc7e5b4e9e6252c843dc2d0787a2 /src/dictionary.h | |
download | netdata-9ce153ce7167c11adba8ac225edc7a707e97c6eb.tar.xz netdata-9ce153ce7167c11adba8ac225edc7a707e97c6eb.zip |
Imported Upstream version 1.0.0upstream/1.0.0
Diffstat (limited to 'src/dictionary.h')
-rwxr-xr-x | src/dictionary.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/dictionary.h b/src/dictionary.h new file mode 100755 index 00000000..9822b23c --- /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 */ |