]> arthur.barton.de Git - netdata.git/blob - src/registry_machine.h
Merge pull request #1998 from ktsaou/master
[netdata.git] / src / registry_machine.h
1 #ifndef NETDATA_REGISTRY_MACHINE_H
2 #define NETDATA_REGISTRY_MACHINE_H
3
4 #include "registry_internals.h"
5
6 // ----------------------------------------------------------------------------
7 // MACHINE structures
8
9 // For each MACHINE-URL pair we keep this
10 struct registry_machine_url {
11     REGISTRY_URL *url;          // de-duplicated URL
12
13     uint8_t flags;
14
15     uint32_t first_t;           // the first time we saw this
16     uint32_t last_t;            // the last time we saw this
17     uint32_t usages;            // how many times this has been accessed
18 };
19 typedef struct registry_machine_url REGISTRY_MACHINE_URL;
20
21 // A machine
22 struct registry_machine {
23     char guid[GUID_LEN + 1];    // the GUID
24
25     uint32_t links;             // the number of REGISTRY_PERSON_URL linked to this machine
26
27     DICTIONARY *machine_urls;   // MACHINE_URL *
28
29     uint32_t first_t;           // the first time we saw this
30     uint32_t last_t;            // the last time we saw this
31     uint32_t usages;            // how many times this has been accessed
32 };
33 typedef struct registry_machine REGISTRY_MACHINE;
34
35 extern REGISTRY_MACHINE *registry_machine_find(const char *machine_guid);
36 extern REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when);
37 extern REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t when);
38 extern REGISTRY_MACHINE *registry_machine_get(const char *machine_guid, time_t when);
39 extern REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when);
40
41 #endif //NETDATA_REGISTRY_MACHINE_H