head	1.12;
access;
symbols
	release_4_2:1.12
	marc_alpha:1.11
	aix_ok:1.11
	Version_2_1:1.8
	Version_2:1.5
	C_Demo_1:1.4;
locks; strict;
comment	@ * @;


1.12
date	94.02.07.11.46.31;	author aoki;	state Exp;
branches;
next	1.11;

1.11
date	93.08.10.01.46.51;	author marc;	state Exp;
branches;
next	1.10;

1.10
date	92.03.02.21.29.12;	author mer;	state Exp;
branches;
next	1.9;

1.9
date	91.11.11.15.59.30;	author mer;	state Exp;
branches;
next	1.8;

1.8
date	91.02.06.18.18.05;	author cimarron;	state Exp;
branches;
next	1.7;

1.7
date	90.08.18.00.40.55;	author cimarron;	state Exp;
branches;
next	1.6;

1.6
date	90.08.17.08.54.18;	author cimarron;	state Exp;
branches;
next	1.5;

1.5
date	90.06.07.18.20.09;	author cimarron;	state Version_2;
branches;
next	1.4;

1.4
date	89.09.05.17.04.35;	author mao;	state C_Demo_1;
branches;
next	1.3;

1.3
date	89.05.07.22.22.41;	author dillon;	state Exp;
branches;
next	1.2;

1.2
date	89.01.31.16.32.32;	author dillon;	state Stab;
branches;
next	1.1;

1.1
date	89.01.17.05.53.55;	author cimarron;	state Exp;
branches;
next	;


desc
@@


1.12
log
@proto fixes
@
text
@/*
 * catcache.h --
 *	Low-level catalog cache definitions.
 *
 * Identification:
 *	$Header: /faerie/aoki/postgres/src/backend/utils/RCS/catcache.h,v 1.11 1993/08/10 01:46:51 marc Exp aoki $
 */

#ifndef	CatCacheIncluded	/* Include this file only once */
#define CatCacheIncluded	1

/* #define	CACHEDEBUG 	/* turns DEBUG elogs on */

#include "tmp/postgres.h"
    
#include "access/skey.h"
#include "access/htup.h"
#include "utils/rel.h"
#include "tmp/simplelists.h"

/*
 *	struct catctup:		tuples in the cache.
 *	struct catcache:	information for managing a cache.
 */

typedef struct catctup {
	HeapTuple	ct_tup;		/* A pointer to a tuple		*/
	SLNode		ct_node;	/* Doubly linked list node	*/
	SLNode		ct_lrunode;	/* ditto, for LRU algorithm	*/
} CatCTup;

typedef struct catcache {
	ObjectId	relationId;
	ObjectId	indexId;
	char		*cc_relname;	/* relation name for defered open */
	char		*cc_indname;	/* index name for defered open */
	HeapTuple	(*cc_iscanfunc)(); /* index scanfunction */
	TupleDescriptor cc_tupdesc; 	/* tuple descriptor from reldesc */
	int		id;		/* XXX could be improved -hirohama */
	short		cc_ntup;	/* # of tuples in this cache	*/
	short		cc_maxtup;	/* max # of tuples allowed (LRU)*/
	short		cc_nkeys;
	short		cc_size;
	short		cc_key[4];
	short		cc_klen[4];
	struct skey	cc_skey[4];
	struct catcache *cc_next;
	SLList    	cc_lrulist;	/* LRU list, most recent first  */
	SLList    	cc_cache[1];	/* Extended over NCCBUCK+1 elmnts*/
					/* used to be: struct catctup	*/
} CatCache;

#define	InvalidCatalogCacheId	(-1)

extern struct catcache	*Caches;

extern void CatalogCacheInitializeCache ARGS((struct catcache *cache, Relation relation));
extern void CatalogCacheSetId ARGS((CatCache *cacheInOutP, int id));
extern long comphash ARGS((long l, char *v));
extern Index CatalogCacheComputeHashIndex ARGS((struct catcache *cacheInP));
extern Index CatalogCacheComputeTupleHashIndex ARGS((struct catcache *cacheInOutP, Relation relation, HeapTuple tuple));
extern void CatCacheRemoveCTup ARGS((CatCache *cache, CatCTup *ct));
extern void CatalogCacheIdInvalidate ARGS((int cacheId, Index hashIndex, ItemPointer pointer));
extern void ResetSystemCache ARGS((void));
extern struct catcache *InitIndexedSysCache ARGS((char *relname, char *indname, int nkeys, int key[], HeapTuple (*iScanfuncP)()));
extern struct catcache *InitSysCache ARGS((char *relname, Name *indname, int nkeys, int key[], HeapTuple (*iScanfuncP)()));
extern HeapTuple SearchSysCache ARGS((struct catcache *cache, DATUM v1, DATUM v2, DATUM v3, DATUM v4));
extern void RelationInvalidateCatalogCacheTuple ARGS((Relation relation, HeapTuple tuple, void (*function)()));

#endif	/* !defined(CatCacheIncluded) */
@


1.11
log
@alpha port
@
text
@d6 1
a6 1
 *	$Header: /usr/local/devel/postgres.alpha.merge/src/backend/utils/RCS/catcache.h,v 1.10 1992/03/02 21:29:12 mer Exp marc $
d57 12
a68 86
/*
 * InitSysCache --
 */
extern
struct catcache *
InitSysCache ARGS(( char *relname, Name *indname, long nkeys , long key [], HeapTuple (*iScanfuncP)() ));

/*
 * ResetSystemCache --
 *	Causes the entire cached system state to be discarded.
 */
extern
void
ResetSystemCache ARGS((
	void
));

/*
 * SearchSysCache --
 */
extern
HeapTuple
SearchSysCache ARGS((
	struct catcache	*cache,
	DATUM		v1,
	DATUM		v2,
	DATUM		v3,
	DATUM		v4
));

/*
 * RelationIdInvalidateCatalogCacheTuple --
 */
extern
void
RelationIdInvalidateCatalogCacheTuple ARGS((
	ObjectId	relationId,
	HeapTuple	tuple,
	void		(*function)()
));

/*
 * CatalogCacheIdInvalidate --
 */
extern
void
CatalogCacheIdInvalidate ARGS((
	int cacheId,
	Index hashIndex,
	ItemPointer pointer
));

/*
 * CatalogCacheComputeTupleHashIndex --
 */
Index CatalogCacheComputeTupleHashIndex ARGS((
	struct catcache *cacheInOutP,
	Relation relation,
	HeapTuple tuple
));

/*
 * CatalogCacheSetId --
 *	XXX This is a temporary function.
 */
extern
void CatalogCacheSetId ARGS((CatCache *cacheInOutP , int id ));

void CatalogCacheInitializeCache ARGS((
	struct catcache *cache,
	Relation relation
));

long comphash ARGS((int l , char *v ));

Index CatalogCacheComputeHashIndex ARGS((struct catcache *cacheInP ));

void CatCacheRemoveCTup ARGS((CatCache *cache , CatCTup *ct ));

struct catcache *InitIndexedSysCache ARGS((
	char *relname, 
	char *indname, 
	long nkeys, 
	long key [],
	HeapTuple (*iScanfuncP)()
));
@


1.10
log
@add a scan func to the cache struct that knows how to do index scans on the
system catalog associated with the cache.
@
text
@d6 1
a6 1
 *	$Header: /users/mer/pg/src/lib/H/utils/RCS/catcache.h,v 1.9 1991/11/11 15:59:30 mer Exp mer $
d62 1
a62 1
InitSysCache ARGS(( char *relname, Name *indname, int nkeys , int key [], HeapTuple (*iScanfuncP)() ));
d130 1
a130 1
int comphash ARGS((int l , char *v ));
d139 2
a140 2
	int nkeys, 
	int key [],
@


1.9
log
@prototyping changes
@
text
@d6 1
a6 1
 *	$Header: RCS/catcache.h,v 1.8 91/02/06 18:18:05 cimarron Exp Locker: mer $
d37 1
d62 1
a62 1
InitSysCache ARGS((char *relname , int nkeys , int key []));
d140 2
a141 1
	int key []
@


1.8
log
@preliminary checkin for access method and system cache changes
@
text
@d6 1
a6 1
 *	$Header: RCS/catcache.h,v 1.7 90/08/18 00:40:55 cimarron Exp Locker: cimarron $
d61 1
a61 5
InitSysCache ARGS((
	Name	relationName,
	int	numberOfAttributes,
	int	key[]
));
d81 1
a81 1
	DATUM		v2
d94 1
a94 5
	void		(*function)(
		int		cacheId,	/* XXX */
		Index		hashIndex,
		ItemPointer	pointer
	)
d103 3
a105 3
	int		cacheId,	/* XXX */
	Index		hashIndex,
	ItemPointer	pointer
d111 4
a114 4
Index
CatalogCacheComputeTupleHashIndex ARGS((
	struct catcache	*cacheInOutP,
	HeapTuple	tuple
d122 18
a139 4
void
CatalogCacheSetId ARGS((
	struct catcache	*cache,
	int		id
@


1.7
log
@eliminated less significant .h files
@
text
@d6 1
a6 1
 *	$Header: RCS/catcache.h,v 1.6 90/08/17 08:54:18 cimarron Exp Locker: cimarron $
d34 4
a37 1
	char		*cc_relname;	/* relation name for defered open  */
@


1.6
log
@added pathnames to #include statements
@
text
@d6 1
a6 1
 *	$Header: RCS/catcache.h,v 1.5 90/06/07 18:20:09 cimarron Version_2 Locker: cimarron $
d14 2
a17 1
#include "tmp/oid.h"
@


1.5
log
@made changes to simplify header include files
@
text
@d6 1
a6 1
 *	$Header: RCS/catcache.h,v 1.4 89/09/05 17:04:35 mao C_Demo_1 $
d14 5
a18 5
#include "skey.h"
#include "htup.h"
#include "oid.h"
#include "rel.h"
#include "simplelists.h"
@


1.4
log
@Working version of C-only demo
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/mao/postgres/src/lib/H/RCS/catcache.h,v 1.3 89/05/07 22:22:41 dillon Exp $
d14 1
a14 1
#include "access.h"	/* XXX struct skey */
@


1.3
log
@simplelist structures changed to use SL convention
@
text
@d6 1
a6 1
 *	$Header: catcache.h,v 1.2 89/01/31 16:32:32 dillon Locked $
@


1.2
log
@txfer from old tree
@
text
@d6 1
a6 1
 *	$Header: catcache.h,v 1.5 89/01/02 15:20:31 dillon Exp $
d27 2
a28 2
	SimpleNode	ct_node;	/* Doubly linked list node	*/
	SimpleNode	ct_lrunode;	/* ditto, for LRU algorithm	*/
d43 2
a44 2
	SimpleList	cc_lrulist;	/* LRU list, most recent first  */
	SimpleList	cc_cache[1];	/* Extended over NCCBUCK+1 elmnts*/
@


1.1
log
@Initial revision
@
text
@a0 27

; /*
; * 
; * POSTGRES Data Base Management System
; * 
; * Copyright (c) 1988 Regents of the University of California
; * 
; * Permission to use, copy, modify, and distribute this software and its
; * documentation for educational, research, and non-profit purposes and
; * without fee is hereby granted, provided that the above copyright
; * notice appear in all copies and that both that copyright notice and
; * this permission notice appear in supporting documentation, and that
; * the name of the University of California not be used in advertising
; * or publicity pertaining to distribution of the software without
; * specific, written prior permission.  Permission to incorporate this
; * software into commercial products can be obtained from the Campus
; * Software Office, 295 Evans Hall, University of California, Berkeley,
; * Ca., 94720 provided only that the the requestor give the University
; * of California a free licence to any derived software for educational
; * and research purposes.  The University of California makes no
; * representations about the suitability of this software for any
; * purpose.  It is provided "as is" without express or implied warranty.
; * 
; */



d6 1
a6 1
 *	$Header: catcache.h,v 1.1 88/11/11 16:36:58 postgres Exp $
d18 1
d25 5
a29 4
struct catctup {
	HeapTuple	ct_tup;
	struct catctup	*ct_next;
};
d31 1
a31 1
struct catcache {
d33 1
d35 2
d43 4
a46 2
	struct catctup	cc_cache[1];
};
@
