OSDN Git Service

More include file cleanups
[pg-rex/syncrep.git] / src / include / access / heapam.h
1 /*-------------------------------------------------------------------------
2  *
3  * heapam.h--
4  *    POSTGRES heap access method definitions.
5  *
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: heapam.h,v 1.4 1996/11/03 08:17:18 scrappy Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef HEAPAM_H
14 #define HEAPAM_H
15
16 #include "access/relscan.h"
17 #include "storage/buf.h"
18
19 /* ----------------------------------------------------------------
20  *              heap access method statistics
21  * ----------------------------------------------------------------
22  */
23
24 typedef struct HeapAccessStatisticsData {
25     time_t  init_global_timestamp;      /* time global statistics started */
26     time_t  local_reset_timestamp;      /* last time local reset was done */
27     time_t  last_request_timestamp;     /* last time stats were requested */
28
29     int global_open;                    
30     int global_openr;
31     int global_close;
32     int global_beginscan;
33     int global_rescan;
34     int global_endscan;
35     int global_getnext;
36     int global_fetch;
37     int global_insert;
38     int global_delete;
39     int global_replace; 
40     int global_markpos; 
41     int global_restrpos;
42     int global_BufferGetRelation;
43     int global_RelationIdGetRelation;
44     int global_RelationIdGetRelation_Buf;
45     int global_RelationNameGetRelation;
46     int global_getreldesc;
47     int global_heapgettup;
48     int global_RelationPutHeapTuple;
49     int global_RelationPutLongHeapTuple;
50
51     int local_open;                     
52     int local_openr;
53     int local_close;
54     int local_beginscan;
55     int local_rescan;
56     int local_endscan;
57     int local_getnext;
58     int local_fetch;
59     int local_insert;
60     int local_delete;
61     int local_replace; 
62     int local_markpos; 
63     int local_restrpos;
64     int local_BufferGetRelation;
65     int local_RelationIdGetRelation;
66     int local_RelationIdGetRelation_Buf;
67     int local_RelationNameGetRelation;
68     int local_getreldesc;
69     int local_heapgettup;
70     int local_RelationPutHeapTuple;
71     int local_RelationPutLongHeapTuple;
72 } HeapAccessStatisticsData;
73
74 typedef HeapAccessStatisticsData *HeapAccessStatistics;
75
76 #define IncrHeapAccessStat(x) \
77     (heap_access_stats == NULL ? 0 : (heap_access_stats->x)++)
78
79 extern HeapAccessStatistics heap_access_stats;  /* in stats.c */
80
81 /* ----------------
82  *      function prototypes for heap access method
83  * ----------------
84  */
85 /* heap_create, heap_creatr, and heap_destroy are declared in catalog/heap.h */
86 #include "catalog/heap.h"
87
88 /* heapam.c */
89 extern void doinsert(Relation relation, HeapTuple tup);
90 extern void SetHeapAccessMethodImmediateInvalidation(bool on);
91
92 extern Relation heap_open(Oid relationId);
93 extern Relation heap_openr(char *relationName);
94 extern void heap_close(Relation relation);
95 extern HeapScanDesc heap_beginscan(Relation relation, int atend,
96                             TimeQual timeQual, unsigned nkeys, ScanKey key);
97 extern void heap_rescan(HeapScanDesc sdesc, bool scanFromEnd, ScanKey key);
98 extern void heap_endscan(HeapScanDesc sdesc);
99 extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
100 extern HeapTuple heap_fetch(Relation relation, TimeQual timeQual,
101                             ItemPointer tid, Buffer *b);
102 extern Oid heap_insert(Relation relation, HeapTuple tup);
103 extern void heap_delete(Relation relation, ItemPointer tid);
104 extern int heap_replace(Relation relation, ItemPointer otid,
105                         HeapTuple tup);
106 extern void heap_markpos(HeapScanDesc sdesc);
107 extern void heap_restrpos(HeapScanDesc sdesc);
108
109 /* in common/heaptuple.c */
110 extern Size ComputeDataSize(TupleDesc tupleDesc, Datum value[], char nulls[]);
111 extern void DataFill(char *data, TupleDesc tupleDesc,
112                      Datum value[], char nulls[], char *infomask,
113                      bits8 *bit);
114 extern int heap_attisnull(HeapTuple tup, int attnum);
115 extern int heap_sysattrlen(AttrNumber attno);
116 extern bool heap_sysattrbyval(AttrNumber attno);
117 extern char *heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
118 extern char *fastgetattr(HeapTuple tup, int attnum,
119                          TupleDesc att, bool *isnull);
120 extern char *heap_getattr(HeapTuple tup, Buffer b, int attnum,
121                           TupleDesc att, bool *isnull);
122 extern HeapTuple heap_copytuple(HeapTuple tuple);
123 extern void heap_deformtuple(HeapTuple tuple, TupleDesc tdesc,
124                              Datum values[], char nulls[]);
125 extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor, 
126                                 Datum value[], char nulls[]);
127 extern HeapTuple heap_modifytuple(HeapTuple tuple, Buffer buffer,
128         Relation relation, Datum replValue[], char replNull[], char repl[]);
129 HeapTuple heap_addheader(uint32 natts, int structlen, char *structure);
130
131 /* in common/heap/stats.c */
132 extern void InitHeapAccessStatistics(void);
133 extern void ResetHeapAccessStatistics(void);
134 extern HeapAccessStatistics GetHeapAccessStatistics(void);
135 extern void PrintHeapAccessStatistics(HeapAccessStatistics stats);
136 extern void PrintAndFreeHeapAccessStatistics(HeapAccessStatistics stats);
137 extern void initam(void);
138
139 #endif  /* HEAPAM_H */