summaryrefslogtreecommitdiffstats
path: root/src/database/engine/pdc.h
blob: 9bae39ade831484c76635f3b109403aca71afa3a (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef DBENGINE_PDC_H
#define DBENGINE_PDC_H

#include "../engine/rrdengine.h"

struct rrdeng_cmd;

#ifdef PDC_USE_JULYL
#define PDCJudyLIns             JulyLIns
#define PDCJudyLGet             JulyLGet
#define PDCJudyLFirst           JulyLFirst
#define PDCJudyLNext            JulyLNext
#define PDCJudyLLast            JulyLLast
#define PDCJudyLPrev            JulyLPrev
#define PDCJudyLFirstThenNext   JulyLFirstThenNext
#define PDCJudyLLastThenPrev    JulyLLastThenPrev
#define PDCJudyLFreeArray       JulyLFreeArray
#else
#define PDCJudyLIns             JudyLIns
#define PDCJudyLGet             JudyLGet
#define PDCJudyLFirst           JudyLFirst
#define PDCJudyLNext            JudyLNext
#define PDCJudyLLast            JudyLLast
#define PDCJudyLPrev            JudyLPrev
#define PDCJudyLFirstThenNext   JudyLFirstThenNext
#define PDCJudyLLastThenPrev    JudyLLastThenPrev
#define PDCJudyLFreeArray       JudyLFreeArray
#endif

typedef struct extent_page_details_list EPDL;
typedef void (*execute_extent_page_details_list_t)(struct rrdengine_instance *ctx, EPDL *epdl, enum storage_priority priority);
void pdc_to_epdl_router(struct rrdengine_instance *ctx, struct page_details_control *pdc, execute_extent_page_details_list_t exec_first_extent_list, execute_extent_page_details_list_t exec_rest_extent_list);
void epdl_find_extent_and_populate_pages(struct rrdengine_instance *ctx, EPDL *epdl, bool worker);

size_t pdc_cache_size(void);
size_t pd_cache_size(void);
size_t epdl_cache_size(void);
size_t deol_cache_size(void);
size_t extent_buffer_cache_size(void);

void pdc_init(void);
void page_details_init(void);
void epdl_init(void);
void deol_init(void);
void extent_buffer_cleanup1(void);

void epdl_cmd_dequeued(void *epdl_ptr);
void epdl_cmd_queued(void *epdl_ptr, struct rrdeng_cmd *cmd);

struct extent_buffer {
    size_t bytes;

    struct {
        struct extent_buffer *prev;
        struct extent_buffer *next;
    } cache;

    uint8_t data[];
};

void extent_buffer_init(void);
struct extent_buffer *extent_buffer_get(size_t size);
void extent_buffer_release(struct extent_buffer *eb);

#endif // DBENGINE_PDC_H