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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*-------------------------------------------------------------------------
*
* itemid.h
* Standard POSTGRES buffer page item identifier/line pointer definitions.
*
*
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/itemid.h
*
*-------------------------------------------------------------------------
*/
/*
* A line pointer on a buffer page. See buffer page definitions and comments
* for an explanation of how line pointers are used.
*
* In some cases a line pointer is "in use" but does not have any associated
* storage on the page. By convention, lp_len == 0 in every line pointer
* that does not have storage, independently of its lp_flags state.
*/
typedef struct ItemIdData
ItemIdData;
typedef ItemIdData *ItemId;
/*
* lp_flags has these possible states. An UNUSED line pointer is available
* for immediate re-use, the other states are not.
*/
/*
* Item offsets and lengths are represented by these types when
* they're not actually stored in an ItemIdData.
*/
typedef uint16 ItemOffset;
typedef uint16 ItemLength;
/* ----------------
* support macros
* ----------------
*/
/*
* ItemIdGetLength
*/
/*
* ItemIdGetOffset
*/
/*
* ItemIdGetFlags
*/
/*
* ItemIdGetRedirect
* In a REDIRECT pointer, lp_off holds offset number for next line pointer
*/
/*
* ItemIdIsValid
* True iff item identifier is valid.
* This is a pretty weak test, probably useful only in Asserts.
*/
/*
* ItemIdIsUsed
* True iff item identifier is in use.
*/
/*
* ItemIdIsNormal
* True iff item identifier is in state NORMAL.
*/
/*
* ItemIdIsRedirected
* True iff item identifier is in state REDIRECT.
*/
/*
* ItemIdIsDead
* True iff item identifier is in state DEAD.
*/
/*
* ItemIdHasStorage
* True iff item identifier has associated storage.
*/
/*
* ItemIdSetUnused
* Set the item identifier to be UNUSED, with no storage.
* Beware of multiple evaluations of itemId!
*/
/*
* ItemIdSetNormal
* Set the item identifier to be NORMAL, with the specified storage.
* Beware of multiple evaluations of itemId!
*/
/*
* ItemIdSetRedirect
* Set the item identifier to be REDIRECT, with the specified link.
* Beware of multiple evaluations of itemId!
*/
/*
* ItemIdSetDead
* Set the item identifier to be DEAD, with no storage.
* Beware of multiple evaluations of itemId!
*/
/*
* ItemIdMarkDead
* Set the item identifier to be DEAD, keeping its existing storage.
*
* Note: in indexes, this is used as if it were a hint-bit mechanism;
* we trust that multiple processors can do this in parallel and get
* the same result.
*/
/* ITEMID_H */