summaryrefslogtreecommitdiffstats
path: root/registry/registry_machine.h
blob: bc95ecf6992813ceab14b47cf983137e11e884a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef NETDATA_REGISTRY_MACHINE_H
#define NETDATA_REGISTRY_MACHINE_H 1

#include "registry_internals.h"

// ----------------------------------------------------------------------------
// MACHINE structures

// For each MACHINE-URL pair we keep this
struct registry_machine_url {
    REGISTRY_URL *url;          // de-duplicated URL

    uint8_t flags;

    uint32_t first_t;           // the first time we saw this
    uint32_t last_t;            // the last time we saw this
    uint32_t usages;            // how many times this has been accessed
};
typedef struct registry_machine_url REGISTRY_MACHINE_URL;

// A machine
struct registry_machine {
    char guid[GUID_LEN + 1];    // the GUID

    uint32_t links;             // the number of REGISTRY_PERSON_URL linked to this machine

    DICTIONARY *machine_urls;   // MACHINE_URL *

    uint32_t first_t;           // the first time we saw this
    uint32_t last_t;            // the last time we saw this
    uint32_t usages;            // how many times this has been accessed
};
typedef struct registry_machine REGISTRY_MACHINE;

REGISTRY_MACHINE *registry_machine_find(const char *machine_guid);
REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when);
REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t when);
REGISTRY_MACHINE *registry_machine_get(const char *machine_guid, time_t when);
REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when);

#endif //NETDATA_REGISTRY_MACHINE_H