head	1.6;
access;
symbols
	Version_2_1:1.5
	Version_2:1.4
	C_Demo_1:1.4;
locks; strict;
comment	@ * @;


1.6
date	91.04.01.08.40.57;	author hong;	state Exp;
branches;
next	1.5;

1.5
date	90.08.17.08.53.43;	author cimarron;	state Exp;
branches;
next	1.4;

1.4
date	89.09.05.17.11.53;	author mao;	state Version_2;
branches;
next	1.3;

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

1.2
date	89.03.22.17.34.31;	author muir;	state Stab;
branches;
next	1.1;

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


desc
@@


1.6
log
@for debugging memory leaks
@
text
@/*
 * sinvaladt.h --
 *  POSTGRES shared cache invalidation segment definitions.
 *
 * Identification:
 * $Header: RCS/sinvaladt.h,v 1.5 90/08/17 08:53:43 cimarron Exp $
 */

#ifndef SinvaladtHIncluded
#define SinvaladtHIncluded 1

#include "tmp/postgres.h"	/* XXX */

#include "storage/ipc.h"
#include "storage/itemptr.h"
#include "storage/sinval.h"
 
/*
 * The structure of the shared cache invaidation segment
 *
 */
/*
A------------- Header info --------------
    criticalSectionSemaphoreId
    generalSemaphoreId
    startEntrySection   (offset a)
    endEntrySection     (offset a + b)
    startFreeSpace      (offset relative to B)
    startEntryChain     (offset relatiev to B)
    endEntryChain       (offset relative to B)
    numEntries
    maxNumEntries
    procState[MaxBackendId] --> limit
				resetState (bool)
a				tag (POSTID)
B------------- Start entry section -------
    SISegEntry  --> entryData --> ... (see  SharedInvalidData!)
                    isfree  (bool)
                    next  (offset to next entry in chain )
b     .... (dynamically growing down)
C----------------End shared segment -------  

*/

/* Parameters (configurable)  *******************************************/
#define MaxBackendId 32      	    /* maximum number of backends   	*/
#define MAXNUMMESSAGES 1000 	    /* maximum number of messages in seg*/


#define	InvalidOffset	1000000000  /* a invalid offset  (End of chain)	*/

typedef struct ProcState {
    	int 	limit;      	/* the number of read messages	    	*/
    	bool 	resetState; 	/* true, if backend has to reset its state */
	int	tag;		/* special tag, recieved from the postmaster */
} ProcState;


typedef struct SISeg {
    IpcSemaphoreId  	criticalSectionSemaphoreId; /* semaphore id     */
    IpcSemaphoreId  	generalSemaphoreId; 	    /* semaphore id     */
    Offset      startEntrySection;  	/* (offset a)	    	    	*/
    Offset      endEntrySection;    	/* (offset a + b)   	    	*/
    Offset      startFreeSpace;	    	/* (offset relative to B)   	*/
    Offset      startEntryChain;    	/* (offset relative to B)   	*/
    Offset      endEntryChain;          /* (offset relative to B)   	*/
    int         numEntries;
    int         maxNumEntries;
    ProcState   procState[MaxBackendId]; /* reflects the invalidation state */
    /* here starts the entry section, controlled by offsets */
} SISeg;
#define SizeSISeg     sizeof(SISeg)

typedef struct SharedInvalidData {
    int	    	    	cacheId;    /* XXX */
    Index   	    	hashIndex;
    ItemPointerData 	pointerData;
} SharedInvalidData;

typedef SharedInvalidData   *SharedInvalid;


typedef struct SISegEntry {
    SharedInvalidData	entryData;  	    	    /* the message data */
    bool                isfree;	    	    	    /* entry free? */
    Offset  	    	next;	    	    	    /* offset to next entry*/
} SISegEntry;

#define SizeOfOneSISegEntry   sizeof(SISegEntry)
    
typedef struct SISegOffsets {
    Offset  startSegment;   	    	/* always 0 (for now) */
    Offset  offsetToFirstEntry;         /* A + a = B */
    Offset  offsetToEndOfSegemnt;       /* A + a + b */
} SISegOffsets;


/****************************************************************************/
/* synchronization of the shared buffer access	    	    	    	    */
/*    access to the buffer is synchronized by the lock manager !!   	    */
/****************************************************************************/

#define SI_LockStartValue  255
#define SI_SharedLock     (-1)
#define SI_ExclusiveLock  (-255)

#endif SinvaladtHIncluded
@


1.5
log
@added pathnames to #include statements
@
text
@d6 1
a6 1
 * $Header: RCS/sinvaladt.h,v 1.4 89/09/05 17:11:53 mao Version_2 Locker: cimarron $
d38 1
a38 1
                    free  (bool)
d85 1
a85 1
    bool                free;	    	    	    /* entry free? */
@


1.4
log
@Working version of C-only demo
@
text
@d6 1
a6 1
 * $Header: /usr6/postgres/mao/postgres/src/lib/H/RCS/sinvaladt.h,v 1.3 89/04/12 19:56:10 dillon Exp $
d9 2
a10 1
#include "postgres.h"	/* XXX */
d12 1
a12 3
#ifndef C_H
#include "c.h"
#endif
d14 3
a16 3
#include "ipc.h"
#include "itemptr.h"
#include "sinval.h"
d106 2
@


1.3
log
@c.h
@
text
@d6 1
a6 1
 * $Header: /usr6/postgres/dillon/ptree/src/lib/H/RCS/sinvaladt.h,v 1.2 89/03/22 17:34:31 muir Stab $
@


1.2
log
@copyright removal
@
text
@d6 1
a6 1
 * $Header: /usr6/postgres/muir/postgres/src/lib/H/RCS/sinvaladt.h,v 1.1 89/01/17 05:54:52 cimarron Exp $
d11 1
d13 1
@


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: sinvaladt.h,v 1.1 88/11/11 16:37:24 postgres Exp $
@
