]> arthur.barton.de Git - netdata.git/blob - src/registry_url.h
removed over-optimization at the registry to simplify its logic and remove race condi...
[netdata.git] / src / registry_url.h
1 #ifndef NETDATA_REGISTRY_URL_H
2 #define NETDATA_REGISTRY_URL_H
3
4 #include "registry_internals.h"
5
6 // ----------------------------------------------------------------------------
7 // URL structures
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
11
12 struct registry_url {
13     avl avl;
14     uint32_t hash;  // the index hash
15
16     uint32_t links; // the number of links to this URL - when none is left, we free it
17
18     uint16_t len;   // the length of the URL in bytes
19     char url[1];    // the URL - dynamically allocated to more size
20 };
21 typedef struct registry_url REGISTRY_URL;
22
23 extern int registry_url_compare(void *a, void *b);
24 extern REGISTRY_URL *registry_url_get(const char *url, size_t urllen) __attribute__((returns_nonnull));
25 extern void registry_url_link(REGISTRY_URL *u);
26 extern void registry_url_unlink(REGISTRY_URL *u);
27
28 #endif //NETDATA_REGISTRY_URL_H