1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01: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
|
|
|
|
*
|
1999-05-07 03:23:11 +02:00
|
|
|
* $Id: lmgr.h,v 1.19 1999/05/07 01:23:05 vadim 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>
|
1998-07-13 18:35:04 +02:00
|
|
|
#include <catalog/catname.h>
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-12-15 13:47:01 +01:00
|
|
|
#define AccessShareLock 1 /* SELECT */
|
|
|
|
#define RowShareLock 2 /* SELECT FOR UPDATE */
|
|
|
|
#define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */
|
|
|
|
#define ShareLock 4
|
|
|
|
#define ShareRowExclusiveLock 5
|
|
|
|
#define ExclusiveLock 6
|
|
|
|
#define AccessExclusiveLock 7
|
|
|
|
|
|
|
|
extern LOCKMETHOD LockTableId;
|
|
|
|
|
|
|
|
|
1998-07-13 18:35:04 +02:00
|
|
|
typedef struct LockRelId
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Oid relId; /* a relation identifier */
|
|
|
|
Oid dbId; /* a database identifier */
|
1998-09-01 06:40:42 +02:00
|
|
|
} LockRelId;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct LockInfoData
|
|
|
|
{
|
1998-07-13 18:35:04 +02:00
|
|
|
LockRelId lockRelId;
|
1997-09-08 23:56:23 +02:00
|
|
|
} LockInfoData;
|
1998-09-01 06:40:42 +02:00
|
|
|
|
1998-08-01 17:26:38 +02:00
|
|
|
typedef LockInfoData *LockInfo;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-08-01 17:26:38 +02:00
|
|
|
#define LockInfoIsValid(lockinfo) PointerIsValid(lockinfo)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-12-15 13:47:01 +01:00
|
|
|
extern LOCKMETHOD InitLockTable(void);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void RelationInitLockInfo(Relation relation);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void LockRelation(Relation relation, LOCKMODE lockmode);
|
|
|
|
extern void UnlockRelation(Relation relation, LOCKMODE lockmode);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-12-15 13:47:01 +01:00
|
|
|
/* this is for indices */
|
|
|
|
extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
|
|
|
|
extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-12-15 13:47:01 +01:00
|
|
|
/* and this is for transactions */
|
|
|
|
extern void XactLockTableInsert(TransactionId xid);
|
|
|
|
extern void XactLockTableDelete(TransactionId xid);
|
|
|
|
extern void XactLockTableWait(TransactionId xid);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1996-11-08 07:02:30 +01:00
|
|
|
/* proc.c */
|
1999-02-19 07:06:39 +01:00
|
|
|
extern void InitProcGlobal(IPCKey key, int maxBackends);
|
1996-11-08 07:02:30 +01:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* LMGR_H */
|