1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* lmgr.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES lock manager definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-02-26 05:46:47 +01:00
|
|
|
* $Id: lmgr.h,v 1.10 1998/02/26 04:43:27 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef LMGR_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define LMGR_H
|
|
|
|
|
1996-11-05 07:11:08 +01:00
|
|
|
#include <storage/lock.h>
|
|
|
|
#include <utils/rel.h>
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
1996-08-28 03:59:28 +02:00
|
|
|
* This was moved from pladt.h for the new lock manager. Want to obsolete
|
|
|
|
* all of the old code.
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct LRelId
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Oid relId; /* a relation identifier */
|
|
|
|
Oid dbId; /* a database identifier */
|
1997-09-08 23:56:23 +02:00
|
|
|
} LRelId;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct LockInfoData
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
bool initialized;
|
|
|
|
LRelId lRelId;
|
|
|
|
TransactionId transactionIdData;
|
|
|
|
uint16 flags;
|
1997-09-08 23:56:23 +02:00
|
|
|
} LockInfoData;
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef LockInfoData *LockInfo;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
#define LockInfoIsValid(linfo) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((PointerIsValid(linfo)) && ((LockInfo) linfo)->initialized)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern LRelId RelationGetLRelId(Relation relation);
|
|
|
|
extern Oid LRelIdGetRelationId(LRelId lRelId);
|
|
|
|
extern void RelationInitLockInfo(Relation relation);
|
|
|
|
extern void RelationSetLockForDescriptorOpen(Relation relation);
|
|
|
|
extern void RelationSetLockForRead(Relation relation);
|
|
|
|
extern void RelationUnsetLockForRead(Relation relation);
|
|
|
|
extern void RelationSetLockForWrite(Relation relation);
|
|
|
|
extern void RelationUnsetLockForWrite(Relation relation);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* used in vaccum.c */
|
1998-02-26 05:46:47 +01:00
|
|
|
extern void
|
|
|
|
RelationSetLockForWritePage(Relation relation,
|
1997-09-07 07:04:48 +02:00
|
|
|
ItemPointer itemPointer);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* used in nbtpage.c, hashpage.c */
|
1998-02-26 05:46:47 +01:00
|
|
|
extern void
|
|
|
|
RelationSetSingleWLockPage(Relation relation,
|
1997-09-07 07:04:48 +02:00
|
|
|
ItemPointer itemPointer);
|
1998-02-26 05:46:47 +01:00
|
|
|
extern void
|
|
|
|
RelationUnsetSingleWLockPage(Relation relation,
|
1997-09-07 07:04:48 +02:00
|
|
|
ItemPointer itemPointer);
|
1998-02-26 05:46:47 +01:00
|
|
|
extern void
|
|
|
|
RelationSetSingleRLockPage(Relation relation,
|
1997-09-07 07:04:48 +02:00
|
|
|
ItemPointer itemPointer);
|
1998-02-26 05:46:47 +01:00
|
|
|
extern void
|
|
|
|
RelationUnsetSingleRLockPage(Relation relation,
|
1997-09-07 07:04:48 +02:00
|
|
|
ItemPointer itemPointer);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void RelationSetRIntentLock(Relation relation);
|
|
|
|
extern void RelationUnsetRIntentLock(Relation relation);
|
|
|
|
extern void RelationSetWIntentLock(Relation relation);
|
|
|
|
extern void RelationUnsetWIntentLock(Relation relation);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* single.c */
|
1997-09-08 04:41:22 +02:00
|
|
|
extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action);
|
1998-02-26 05:46:47 +01:00
|
|
|
extern bool
|
|
|
|
SingleLockPage(LockInfo linfo, ItemPointer tidPtr,
|
1996-08-28 03:59:28 +02:00
|
|
|
LOCKT lockt, int action);
|
|
|
|
|
1996-11-08 07:02:30 +01:00
|
|
|
/* proc.c */
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void InitProcGlobal(IPCKey key);
|
1996-11-08 07:02:30 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* LMGR_H */
|