registry_machine.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_REGISTRY_MACHINE_H
  3. #define NETDATA_REGISTRY_MACHINE_H 1
  4. #include "registry_internals.h"
  5. // ----------------------------------------------------------------------------
  6. // MACHINE structures
  7. // For each MACHINE-URL pair we keep this
  8. struct registry_machine_url {
  9. STRING *url; // de-duplicated URL
  10. uint8_t flags;
  11. uint32_t first_t; // the first time we saw this
  12. uint32_t last_t; // the last time we saw this
  13. uint32_t usages; // how many times this has been accessed
  14. struct registry_machine_url *prev, *next;
  15. };
  16. typedef struct registry_machine_url REGISTRY_MACHINE_URL;
  17. // A machine
  18. struct registry_machine {
  19. char guid[GUID_LEN + 1]; // the GUID
  20. uint32_t links; // the number of REGISTRY_PERSON_URL linked to this machine
  21. REGISTRY_MACHINE_URL *machine_urls; // MACHINE_URL *
  22. uint32_t first_t; // the first time we saw this
  23. uint32_t last_t; // the last time we saw this
  24. uint32_t usages; // how many times this has been accessed
  25. };
  26. typedef struct registry_machine REGISTRY_MACHINE;
  27. REGISTRY_MACHINE *registry_machine_find(const char *machine_guid);
  28. REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING *u, time_t when);
  29. REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t when);
  30. REGISTRY_MACHINE *registry_machine_find_or_create(const char *machine_guid, time_t when, bool is_dummy);
  31. REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, STRING *url, time_t when);
  32. REGISTRY_MACHINE_URL *registry_machine_url_find(REGISTRY_MACHINE *m, STRING *url);
  33. void registry_machine_url_unlink_from_machine_and_free(REGISTRY_MACHINE *m, REGISTRY_MACHINE_URL *mu);
  34. #endif //NETDATA_REGISTRY_MACHINE_H