1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

Improve our #include situation by moving pointer types away from the

corresponding struct definitions.  This allows other headers to avoid including
certain highly-loaded headers such as rel.h and relscan.h, instead using just
relcache.h, heapam.h or genam.h, which are more lightweight and thus cause less
unnecessary dependencies.
This commit is contained in:
Alvaro Herrera
2008-06-19 00:46:06 +00:00
parent d1da215d32
commit a3540b0f65
113 changed files with 292 additions and 205 deletions

View File

@@ -7,19 +7,20 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/genam.h,v 1.73 2008/06/08 22:41:04 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/genam.h,v 1.74 2008/06/19 00:46:05 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef GENAM_H
#define GENAM_H
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/skey.h"
#include "nodes/tidbitmap.h"
#include "storage/buf.h"
#include "storage/lock.h"
#include "utils/rel.h"
#include "utils/relcache.h"
#include "utils/snapshot.h"
/*
* Struct for statistics returned by ambuild
@@ -73,21 +74,21 @@ typedef struct IndexBulkDeleteResult
/* Typedef for callback function to determine if a tuple is bulk-deletable */
typedef bool (*IndexBulkDeleteCallback) (ItemPointer itemptr, void *state);
/* Struct for heap-or-index scans of system tables */
typedef struct SysScanDescData
{
Relation heap_rel; /* catalog being scanned */
Relation irel; /* NULL if doing heap scan */
HeapScanDesc scan; /* only valid in heap-scan case */
IndexScanDesc iscan; /* only valid in index-scan case */
} SysScanDescData;
typedef SysScanDescData *SysScanDesc;
/* struct definitions appear in relscan.h */
typedef struct IndexScanDescData *IndexScanDesc;
typedef struct SysScanDescData *SysScanDesc;
/*
* generalized index_ interface routines (in indexam.c)
*/
/*
* IndexScanIsValid
* True iff the index scan is valid.
*/
#define IndexScanIsValid(scan) PointerIsValid(scan)
extern Relation index_open(Oid relationId, LOCKMODE lockmode);
extern void index_close(Relation relation, LOCKMODE lockmode);

View File

@@ -4,7 +4,7 @@
*
* Copyright (c) 2006-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.21 2008/06/06 22:35:22 alvherre Exp $
* $PostgreSQL: pgsql/src/include/access/gin.h,v 1.22 2008/06/19 00:46:05 alvherre Exp $
*--------------------------------------------------------------------------
*/
@@ -12,8 +12,8 @@
#ifndef GIN_H
#define GIN_H
#include "access/genam.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/xlog.h"
#include "fmgr.h"
#include "nodes/tidbitmap.h"

View File

@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/gist.h,v 1.60 2008/05/12 00:00:53 alvherre Exp $
* $PostgreSQL: pgsql/src/include/access/gist.h,v 1.61 2008/06/19 00:46:05 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,8 +18,9 @@
#include "access/xlog.h"
#include "access/xlogdefs.h"
#include "storage/block.h"
#include "storage/bufpage.h"
#include "utils/rel.h"
#include "utils/relcache.h"
/*
* amproc indexes for GiST indexes.

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.30 2008/06/12 09:12:31 heikki Exp $
* $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.31 2008/06/19 00:46:05 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,9 +16,7 @@
#include "access/gist.h"
#include "access/itup.h"
#include "access/xlog.h"
#include "access/xlogdefs.h"
#include "fmgr.h"
#include "storage/bufmgr.h"
#define GIST_UNLOCK BUFFER_LOCK_UNLOCK
#define GIST_SHARE BUFFER_LOCK_SHARE

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.87 2008/04/10 22:25:25 tgl Exp $
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.88 2008/06/19 00:46:05 alvherre Exp $
*
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
@@ -17,12 +17,13 @@
#ifndef HASH_H
#define HASH_H
#include "access/genam.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/xlog.h"
#include "fmgr.h"
#include "storage/lock.h"
#include "utils/relcache.h"
/*
* Mapping from hash bucket number to physical block number of bucket's

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.136 2008/06/12 09:12:31 heikki Exp $
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.137 2008/06/19 00:46:06 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,11 +15,13 @@
#define HEAPAM_H
#include "access/htup.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/skey.h"
#include "access/xlog.h"
#include "nodes/primnodes.h"
#include "storage/bufpage.h"
#include "storage/lock.h"
#include "utils/relcache.h"
#include "utils/snapshot.h"
@@ -50,6 +52,15 @@ extern Relation heap_openrv(const RangeVar *relation, LOCKMODE lockmode);
#define heap_close(r,l) relation_close(r,l)
/* struct definition appears in relscan.h */
typedef struct HeapScanDescData *HeapScanDesc;
/*
* HeapScanIsValid
* True iff the heap scan is valid.
*/
#define HeapScanIsValid(scan) PointerIsValid(scan)
extern HeapScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
int nkeys, ScanKey key);
extern HeapScanDesc heap_beginscan_strat(Relation relation, Snapshot snapshot,

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/hio.h,v 1.35 2008/01/01 19:45:56 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/hio.h,v 1.36 2008/06/19 00:46:06 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#define HIO_H
#include "access/htup.h"
#include "utils/rel.h"
#include "utils/relcache.h"
#include "storage/buf.h"
extern void RelationPutHeapTuple(Relation relation, Buffer buffer,

View File

@@ -7,15 +7,15 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.119 2008/06/06 22:35:22 alvherre Exp $
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.120 2008/06/19 00:46:06 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef NBTREE_H
#define NBTREE_H
#include "access/genam.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/xlog.h"
#include "access/xlogutils.h"

View File

@@ -7,18 +7,15 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.65 2008/05/12 00:00:53 alvherre Exp $
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.66 2008/06/19 00:46:06 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef RELSCAN_H
#define RELSCAN_H
#include "access/htup.h"
#include "access/skey.h"
#include "storage/bufpage.h"
#include "utils/rel.h"
#include "utils/snapshot.h"
#include "access/genam.h"
#include "access/heapam.h"
typedef struct HeapScanDescData
@@ -54,8 +51,6 @@ typedef struct HeapScanDescData
OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */
} HeapScanDescData;
typedef HeapScanDescData *HeapScanDesc;
/*
* We use the same IndexScanDescData structure for both amgettuple-based
* and amgetbitmap-based index scans. Some fields are only relevant in
@@ -89,19 +84,13 @@ typedef struct IndexScanDescData
TransactionId xs_prev_xmax; /* previous HOT chain member's XMAX, if any */
} IndexScanDescData;
typedef IndexScanDescData *IndexScanDesc;
/*
* HeapScanIsValid
* True iff the heap scan is valid.
*/
#define HeapScanIsValid(scan) PointerIsValid(scan)
/*
* IndexScanIsValid
* True iff the index scan is valid.
*/
#define IndexScanIsValid(scan) PointerIsValid(scan)
/* Struct for heap-or-index scans of system tables */
typedef struct SysScanDescData
{
Relation heap_rel; /* catalog being scanned */
Relation irel; /* NULL if doing heap scan */
HeapScanDesc scan; /* only valid in heap-scan case */
IndexScanDesc iscan; /* only valid in index-scan case */
} SysScanDescData;
#endif /* RELSCAN_H */

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/rewriteheap.h,v 1.4 2008/01/01 19:45:56 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/rewriteheap.h,v 1.5 2008/06/19 00:46:06 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -14,7 +14,7 @@
#define REWRITE_HEAP_H
#include "access/htup.h"
#include "utils/rel.h"
#include "utils/relcache.h"
/* struct definition is private to rewriteheap.c */
typedef struct RewriteStateData *RewriteState;

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/access/tuptoaster.h,v 1.39 2008/05/12 00:00:53 alvherre Exp $
* $PostgreSQL: pgsql/src/include/access/tuptoaster.h,v 1.40 2008/06/19 00:46:06 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#include "access/htup.h"
#include "storage/bufpage.h"
#include "utils/rel.h"
#include "utils/relcache.h"
/*
* This enables de-toasting of index entries. Needed until VACUUM is

View File

@@ -6,13 +6,15 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/xlogutils.h,v 1.24 2008/06/12 09:12:31 heikki Exp $
* $PostgreSQL: pgsql/src/include/access/xlogutils.h,v 1.25 2008/06/19 00:46:06 alvherre Exp $
*/
#ifndef XLOG_UTILS_H
#define XLOG_UTILS_H
#include "storage/buf.h"
#include "utils/rel.h"
#include "storage/relfilenode.h"
#include "storage/block.h"
#include "utils/relcache.h"
extern void XLogCheckInvalidPages(void);