registry_machine.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. REGISTRY_URL *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. };
  15. typedef struct registry_machine_url REGISTRY_MACHINE_URL;
  16. // A machine
  17. struct registry_machine {
  18. char guid[GUID_LEN + 1]; // the GUID
  19. uint32_t links; // the number of REGISTRY_PERSON_URL linked to this machine
  20. DICTIONARY *machine_urls; // MACHINE_URL *
  21. uint32_t first_t; // the first time we saw this
  22. uint32_t last_t; // the last time we saw this
  23. uint32_t usages; // how many times this has been accessed
  24. };
  25. typedef struct registry_machine REGISTRY_MACHINE;
  26. extern REGISTRY_MACHINE *registry_machine_find(const char *machine_guid);
  27. extern REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when);
  28. extern REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t when);
  29. extern REGISTRY_MACHINE *registry_machine_get(const char *machine_guid, time_t when);
  30. extern REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, REGISTRY_URL *u, time_t when);
  31. #endif //NETDATA_REGISTRY_MACHINE_H