- Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathrumsort.h
58 lines (46 loc) · 1.85 KB
/
rumsort.h
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
/*-------------------------------------------------------------------------
*
* rumsort.h
* Generalized tuple sorting routines.
*
* This module handles sorting of RumSortItem or RumScanItem structures.
* It contains copy of static functions from
* src/backend/utils/sort/tuplesort.c.
*
* Portions Copyright (c) 2015-2024, Postgres Professional
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*-------------------------------------------------------------------------
*/
#ifndefRUMSORT_H
#defineRUMSORT_H
#include"postgres.h"
#include"fmgr.h"
#include"executor/tuptable.h"
/* RumTuplesortstate is an opaque type whose details are not known outside
* rumsort.c.
*/
typedefstructTuplesortstateRumTuplesortstate;
structRumScanItem;
typedefstruct
{
ItemPointerDataiptr;
boolrecheck;
float8data[FLEXIBLE_ARRAY_MEMBER];
} RumSortItem;
#defineRumSortItemSize(nKeys) (offsetof(RumSortItem,data)+(nKeys)*sizeof(float8))
externMemoryContextrum_tuplesort_get_memorycontext(RumTuplesortstate*state);
externRumTuplesortstate*rum_tuplesort_begin_rum(intworkMem,
intnKeys, boolrandomAccess, boolcompareItemPointer);
externRumTuplesortstate*rum_tuplesort_begin_rumitem(intworkMem,
FmgrInfo*cmp);
externvoidrum_tuplesort_putrum(RumTuplesortstate*state, RumSortItem*item);
externvoidrum_tuplesort_putrumitem(RumTuplesortstate*state, structRumScanItem*item);
externvoidrum_tuplesort_performsort(RumTuplesortstate*state);
externRumSortItem*rum_tuplesort_getrum(RumTuplesortstate*state, boolforward,
bool*should_free);
externstructRumScanItem*rum_tuplesort_getrumitem(RumTuplesortstate*state, boolforward,
bool*should_free);
externvoidrum_tuplesort_end(RumTuplesortstate*state);
#endif/* RUMSORT_H */