1 #ifndef NETDATA_REGISTRY_URL_H
2 #define NETDATA_REGISTRY_URL_H
4 #include "registry_internals.h"
6 // ----------------------------------------------------------------------------
8 // Save memory by de-duplicating URLs
9 // so instead of storing URLs all over the place
10 // we store them here and we keep pointers elsewhere
14 uint32_t hash; // the index hash
16 uint32_t links; // the number of links to this URL - when none is left, we free it
18 uint16_t len; // the length of the URL in bytes
19 char url[1]; // the URL - dynamically allocated to more size
21 typedef struct registry_url REGISTRY_URL;
24 extern int registry_url_compare(void *a, void *b);
25 extern REGISTRY_URL *registry_url_index_del(REGISTRY_URL *u);
26 extern REGISTRY_URL *registry_url_index_add(REGISTRY_URL *u) __attribute__((returns_nonnull));
28 // REGISTRY_URL MANAGEMENT
29 extern REGISTRY_URL *registry_url_get(const char *url, size_t urllen) __attribute__((returns_nonnull));
30 extern void registry_url_link(REGISTRY_URL *u);
31 extern void registry_url_unlink(REGISTRY_URL *u);
33 #endif //NETDATA_REGISTRY_URL_H