master
h 66 lines 1.59 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef DBENGINE_PAGE_H
4 #define DBENGINE_PAGE_H
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 #include "libnetdata/libnetdata.h"
11
12 typedef struct pgd_cursor {
13 struct pgd *pgd;
14 uint32_t position;
15 uint32_t slots;
16
17 gorilla_reader_t gr;
18 } PGDC;
19
20 #include "rrdengine.h"
21
22 typedef struct pgd PGD;
23
24 #define PGD_EMPTY (PGD *)(-1)
25
26 void pgd_init_arals(void);
27
28 PGD *pgd_create(uint8_t type, uint32_t slots);
29 PGD *pgd_create_from_disk_data(uint8_t type, void *base, uint32_t size);
30 void pgd_free(PGD *pg);
31
32 uint32_t pgd_type(PGD *pg);
33 bool pgd_is_empty(PGD *pg);
34 uint32_t pgd_slots_used(PGD *pg);
35
36 uint32_t pgd_buffer_memory_footprint(PGD *pg);
37 uint32_t pgd_memory_footprint(PGD *pg);
38 uint32_t pgd_capacity(PGD *pg);
39 uint32_t pgd_disk_footprint(PGD *pg);
40
41 struct aral_statistics *pgd_aral_stats(void);
42 size_t pgd_padding_bytes(void);
43
44 void pgd_copy_to_extent(PGD *pg, uint8_t *dst, uint32_t dst_size);
45
46 size_t pgd_append_point(PGD *pg,
47 usec_t point_in_time_ut,
48 NETDATA_DOUBLE n,
49 NETDATA_DOUBLE min_value,
50 NETDATA_DOUBLE max_value,
51 uint16_t count,
52 uint16_t anomaly_count,
53 SN_FLAGS flags,
54 uint32_t expected_slot);
55
56 void pgdc_reset(PGDC *pgdc, PGD *pgd, uint32_t position);
57 bool pgdc_get_next_point(PGDC *pgdc, uint32_t expected_position, STORAGE_POINT *sp);
58
59 void *dbengine_extent_alloc(size_t size);
60 void dbengine_extent_free(void *extent, size_t size);
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif // DBENGINE_PAGE_H