Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a8820e

Browse files
committed
Moved from backend/access to include/access
1 parent9247b29 commit5a8820e

28 files changed

+2418
-0
lines changed

‎src/include/access/attnum.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* attnum.h--
4+
* POSTGRES attribute number definitions.
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: attnum.h,v 1.1 1996/08/27 21:50:07 scrappy Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefATTNUM_H
14+
#defineATTNUM_H
15+
16+
#include"c.h"
17+
18+
/*
19+
* user defined attribute numbers start at 1.-ay 2/95
20+
*/
21+
typedefint16AttrNumber;
22+
23+
#defineInvalidAttrNumber0
24+
25+
/* ----------------
26+
*support macros
27+
* ----------------
28+
*/
29+
/*
30+
* AttributeNumberIsValid --
31+
*True iff the attribute number is valid.
32+
*/
33+
#defineAttributeNumberIsValid(attributeNumber) \
34+
((bool) ((attributeNumber) != InvalidAttrNumber))
35+
36+
/*
37+
* AttrNumberIsForUserDefinedAttr --
38+
*True iff the attribute number corresponds to an user defined attribute.
39+
*/
40+
#defineAttrNumberIsForUserDefinedAttr(attributeNumber) \
41+
((bool) ((attributeNumber) > 0))
42+
43+
/*
44+
* AttrNumberGetAttrOffset --
45+
*Returns the attribute offset for an attribute number.
46+
*
47+
* Note:
48+
*Assumes the attribute number is for an user defined attribute.
49+
*/
50+
#defineAttrNumberGetAttrOffset(attNum) \
51+
(AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)) ? \
52+
((attNum - 1)) : 0)
53+
54+
/*
55+
* AttributeOffsetGetAttributeNumber --
56+
*Returns the attribute number for an attribute offset.
57+
*/
58+
#defineAttrOffsetGetAttrNumber(attributeOffset) \
59+
((AttrNumber) (1 + attributeOffset))
60+
61+
#endif/* ATTNUM_H */

‎src/include/access/funcindex.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* funcindex.h--
4+
*
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: funcindex.h,v 1.1 1996/08/27 21:50:08 scrappy Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef_FUNC_INDEX_INCLUDED_
14+
#define_FUNC_INDEX_INCLUDED_
15+
16+
#include"postgres.h"
17+
18+
typedefstruct {
19+
intnargs;
20+
Oidarglist[8];
21+
OidprocOid;
22+
NameDatafuncName;
23+
}FuncIndexInfo;
24+
25+
typedefFuncIndexInfo*FuncIndexInfoPtr;
26+
27+
/*
28+
* some marginally useful macro definitions
29+
*/
30+
/* #define FIgetname(FINFO) (&((FINFO)->funcName.data[0]))*/
31+
#defineFIgetname(FINFO) (FINFO)->funcName.data
32+
#defineFIgetnArgs(FINFO) (FINFO)->nargs
33+
#defineFIgetProcOid(FINFO) (FINFO)->procOid
34+
#defineFIgetArg(FINFO,argnum) (FINFO)->arglist[argnum]
35+
#defineFIgetArglist(FINFO) (FINFO)->arglist
36+
37+
#defineFIsetnArgs(FINFO,numargs) ((FINFO)->nargs = numargs)
38+
#defineFIsetProcOid(FINFO,id) ((FINFO)->procOid = id)
39+
#defineFIsetArg(FINFO,argnum,argtype) ((FINFO)->arglist[argnum] = argtype)
40+
41+
#defineFIisFunctionalIndex(FINFO) (FINFO->procOid != InvalidOid)
42+
43+
#endif/* FUNCINDEX_H */

‎src/include/access/genam.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* genam.h--
4+
* POSTGRES general access method definitions.
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: genam.h,v 1.1 1996/08/27 21:50:09 scrappy Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefGENAM_H
14+
#defineGENAM_H
15+
16+
#include"postgres.h"
17+
18+
#include"access/attnum.h"
19+
#include"access/htup.h"
20+
#include"access/istrat.h"
21+
#include"access/itup.h"
22+
#include"access/relscan.h"
23+
#include"access/skey.h"
24+
#include"access/sdir.h"
25+
#include"access/funcindex.h"
26+
27+
/* ----------------
28+
*generalized index_ interface routines
29+
* ----------------
30+
*/
31+
externRelationindex_open(OidrelationId);
32+
externRelationindex_openr(char*relationName);
33+
externvoidindex_close(Relationrelation);
34+
externInsertIndexResultindex_insert(Relationrelation,
35+
Datum*datum,char*nulls,
36+
ItemPointerheap_t_ctid);
37+
externvoidindex_delete(Relationrelation,ItemPointerindexItem);
38+
externIndexScanDescindex_beginscan(Relationrelation,boolscanFromEnd,
39+
uint16numberOfKeys,ScanKeykey);
40+
externvoidindex_rescan(IndexScanDescscan,boolscanFromEnd,ScanKeykey);
41+
externvoidindex_endscan(IndexScanDescscan);
42+
externvoidindex_markpos(IndexScanDescscan);
43+
externvoidindex_restrpos(IndexScanDescscan);
44+
externRetrieveIndexResultindex_getnext(IndexScanDescscan,
45+
ScanDirectiondirection);
46+
externRegProcedureindex_getprocid(Relationirel,AttrNumberattnum,
47+
uint16procnum);
48+
externDatumGetIndexValue(HeapTupletuple,TupleDeschTupDesc,
49+
intattOff,AttrNumberattrNums[],FuncIndexInfo*fInfo,
50+
bool*attNull,Bufferbuffer);
51+
52+
/* in genam.c */
53+
externIndexScanDescRelationGetIndexScan(Relationrelation,boolscanFromEnd,
54+
uint16numberOfKeys,ScanKeykey);
55+
externvoidIndexScanRestart(IndexScanDescscan,boolscanFromEnd,
56+
ScanKeykey);
57+
externvoidIndexScanEnd(IndexScanDescscan);
58+
externvoidIndexScanMarkPosition(IndexScanDescscan);
59+
externvoidIndexScanRestorePosition(IndexScanDescscan);
60+
61+
#endif/* GENAM_H */

‎src/include/access/gist.h

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* gist.h--
4+
* common declarations for the GiST access method code.
5+
*
6+
*
7+
*
8+
*
9+
*
10+
*-------------------------------------------------------------------------
11+
*/
12+
#ifndefGIST_H
13+
#defineGIST_H
14+
15+
#include"utils/rel.h"
16+
#include"storage/off.h"
17+
#include"storage/block.h"
18+
#include"storage/bufpage.h"
19+
#include"access/skey.h"
20+
21+
/*
22+
** You can have as many strategies as you please in GiSTs, as
23+
** long as your consistent method can handle them
24+
*/
25+
#defineGISTNStrategies100
26+
27+
/*
28+
** Helper routines
29+
*/
30+
#defineGISTNProcs8
31+
#defineGIST_CONSISTENT_PROC1
32+
#defineGIST_UNION_PROC2
33+
#defineGIST_COMPRESS_PROC3
34+
#defineGIST_DECOMPRESS_PROC4
35+
#defineGIST_PENALTY_PROC5
36+
#defineGIST_PICKSPLIT_PROC6
37+
#defineGIST_EQUAL_PROC 7
38+
#defineGIST_INFO_PROC8
39+
40+
#defineF_LEAF(1 << 0)
41+
42+
typedefstructGISTPageOpaqueData {
43+
uint32flags;
44+
}GISTPageOpaqueData;
45+
46+
typedefGISTPageOpaqueData*GISTPageOpaque;
47+
48+
#defineGIST_LEAF(entry) (((GISTPageOpaque) PageGetSpecialPointer((entry)->page))->flags & F_LEAF)
49+
50+
/*
51+
* When we descend a tree, we keep a stack of parent pointers.
52+
*/
53+
54+
typedefstructGISTSTACK {
55+
structGISTSTACK*gs_parent;
56+
OffsetNumbergs_child;
57+
BlockNumbergs_blk;
58+
}GISTSTACK;
59+
60+
typedefstructGISTSTATE {
61+
func_ptrconsistentFn;
62+
func_ptrunionFn;
63+
func_ptrcompressFn;
64+
func_ptrdecompressFn;
65+
func_ptrpenaltyFn;
66+
func_ptrpicksplitFn;
67+
func_ptrequalFn;
68+
boolhaskeytype;
69+
boolkeytypbyval;
70+
}GISTSTATE;
71+
72+
73+
/*
74+
** When we're doing a scan, we need to keep track of the parent stack
75+
** for the marked and current items.
76+
*/
77+
78+
typedefstructGISTScanOpaqueData {
79+
structGISTSTACK*s_stack;
80+
structGISTSTACK*s_markstk;
81+
uint16s_flags;
82+
structGISTSTATE*giststate;
83+
}GISTScanOpaqueData;
84+
85+
typedefGISTScanOpaqueData*GISTScanOpaque;
86+
87+
/*
88+
** When we're doing a scan and updating a tree at the same time, the
89+
** updates may affect the scan. We use the flags entry of the scan's
90+
** opaque space to record our actual position in response to updates
91+
** that we can't handle simply by adjusting pointers.
92+
*/
93+
94+
#defineGS_CURBEFORE((uint16) (1 << 0))
95+
#defineGS_MRKBEFORE((uint16) (1 << 1))
96+
97+
/* root page of a gist */
98+
#defineGISTP_ROOT0
99+
100+
/*
101+
** When we update a relation on which we're doing a scan, we need to
102+
** check the scan and fix it if the update affected any of the pages it
103+
** touches. Otherwise, we can miss records that we should see. The only
104+
** times we need to do this are for deletions and splits. See the code in
105+
** gistscan.c for how the scan is fixed. These two constants tell us what sort
106+
** of operation changed the index.
107+
*/
108+
109+
#defineGISTOP_DEL0
110+
#defineGISTOP_SPLIT1
111+
112+
/*
113+
** This is the Split Vector to be returned by the PickSplit method.
114+
*/
115+
typedefstructGIST_SPLITVEC {
116+
OffsetNumber*spl_left;/* array of entries that go left */
117+
intspl_nleft;/* size of this array */
118+
char*spl_ldatum;/* Union of keys in spl_left */
119+
OffsetNumber*spl_right;/* array of entries that go right */
120+
intspl_nright;/* size of the array */
121+
char*spl_rdatum;/* Union of keys in spl_right */
122+
}GIST_SPLITVEC;
123+
124+
/*
125+
** An entry on a GiST node. Contains the key (pred), as well as
126+
** its own location (rel,page,offset) which can supply the matching
127+
** pointer. The size of the pred is in bytes, and leafkey is a flag to
128+
** tell us if the entry is in a leaf node.
129+
*/
130+
typedefstructGISTENTRY {
131+
char*pred;
132+
Relationrel;
133+
Pagepage;
134+
OffsetNumberoffset;
135+
intbytes;
136+
boolleafkey;
137+
}GISTENTRY;
138+
139+
/*
140+
** macro to initialize a GISTENTRY
141+
*/
142+
#definegistentryinit(e,pr,r,pg,o,b,l)\
143+
{(e).pred = pr; (e).rel = r; (e).page = pg; (e).offset = o; (e).bytes = b; (e).leafkey = l;}
144+
145+
/* defined in gist.c */
146+
externvoidgistfreestack(GISTSTACK*s);
147+
externvoidinitGISTstate(GISTSTATE*giststate,Relationindex);
148+
externvoidgistdentryinit(GISTSTATE*giststate,GISTENTRY*e,char*pr,
149+
Relationr,Pagepg,OffsetNumbero,intb,booll) ;
150+
externvoidgistcentryinit(GISTSTATE*giststate,GISTENTRY*e,char*pr,
151+
Relationr,Pagepg,OffsetNumbero,intb,booll) ;
152+
#endif/* GIST_H */

‎src/include/access/gistscan.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* gistscan.h--
4+
* routines defined in access/gisr/gistscan.c
5+
*
6+
*
7+
*
8+
* rtscan.h,v 1.2 1995/06/14 00:06:58 jolly Exp
9+
*
10+
*-------------------------------------------------------------------------
11+
*/
12+
#ifndefGISTSCAN_H
13+
14+
voidgistadjscans(Relationr,intop,BlockNumberblkno,OffsetNumberoffnum);
15+
16+
#endif/* GISTSCAN_H */

‎src/include/access/giststrat.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* giststrat.h--
4+
* routines defined in access/gist/giststrat.c
5+
*
6+
*
7+
*
8+
* rtstrat.h,v 1.2 1995/02/12 02:54:51 andrew Exp
9+
*
10+
*-------------------------------------------------------------------------
11+
*/
12+
#ifndefGISTSTRAT_H
13+
14+
#endif/* GISTSTRAT_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp