page.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef DBENGINE_PAGE_H
  3. #define DBENGINE_PAGE_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #include "libnetdata/libnetdata.h"
  8. typedef struct pgd_cursor {
  9. struct pgd *pgd;
  10. uint32_t position;
  11. uint32_t slots;
  12. gorilla_reader_t gr;
  13. } PGDC;
  14. #include "rrdengine.h"
  15. typedef struct pgd PGD;
  16. #define PGD_EMPTY (PGD *)(-1)
  17. void pgd_init_arals(void);
  18. PGD *pgd_create(uint8_t type, uint32_t slots);
  19. PGD *pgd_create_from_disk_data(uint8_t type, void *base, uint32_t size);
  20. void pgd_free(PGD *pg);
  21. uint32_t pgd_type(PGD *pg);
  22. bool pgd_is_empty(PGD *pg);
  23. uint32_t pgd_slots_used(PGD *pg);
  24. uint32_t pgd_memory_footprint(PGD *pg);
  25. uint32_t pgd_disk_footprint(PGD *pg);
  26. void pgd_copy_to_extent(PGD *pg, uint8_t *dst, uint32_t dst_size);
  27. void pgd_append_point(PGD *pg,
  28. usec_t point_in_time_ut,
  29. NETDATA_DOUBLE n,
  30. NETDATA_DOUBLE min_value,
  31. NETDATA_DOUBLE max_value,
  32. uint16_t count,
  33. uint16_t anomaly_count,
  34. SN_FLAGS flags,
  35. uint32_t expected_slot);
  36. void pgdc_reset(PGDC *pgdc, PGD *pgd, uint32_t position);
  37. bool pgdc_get_next_point(PGDC *pgdc, uint32_t expected_position, STORAGE_POINT *sp);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif // DBENGINE_PAGE_H