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
|
|
|
*
|
|
|
|
*
|
2004-12-31 23:04:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2005-12-09 02:22:04 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.53 2005/12/09 01:22:04 tgl 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
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "storage/lock.h"
|
|
|
|
#include "utils/rel.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2005-04-30 21:03:33 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void RelationInitLockInfo(Relation relation);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-12-22 01:51:54 +01:00
|
|
|
/* Lock a relation */
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void LockRelation(Relation relation, LOCKMODE lockmode);
|
2001-06-22 02:04:59 +02:00
|
|
|
extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode);
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void UnlockRelation(Relation relation, LOCKMODE lockmode);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2005-06-15 00:15:33 +02:00
|
|
|
extern void LockRelationForSession(LockRelId *relid, bool istemprel,
|
2005-10-15 04:49:52 +02:00
|
|
|
LOCKMODE lockmode);
|
2000-12-22 01:51:54 +01:00
|
|
|
extern void UnlockRelationForSession(LockRelId *relid, LOCKMODE lockmode);
|
|
|
|
|
2005-04-30 00:28:24 +02:00
|
|
|
/* Lock a relation for extension */
|
|
|
|
extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode);
|
|
|
|
extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode);
|
|
|
|
|
|
|
|
/* Lock a page (currently only used within indexes) */
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
|
2003-09-05 00:06:27 +02:00
|
|
|
extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2005-04-30 21:03:33 +02:00
|
|
|
/* Lock a tuple (see heap_lock_tuple before assuming you understand this) */
|
|
|
|
extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);
|
2005-08-01 22:31:16 +02:00
|
|
|
extern bool ConditionalLockTuple(Relation relation, ItemPointer tid,
|
2005-10-15 04:49:52 +02:00
|
|
|
LOCKMODE lockmode);
|
2005-04-30 21:03:33 +02:00
|
|
|
extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);
|
|
|
|
|
2000-12-22 01:51:54 +01:00
|
|
|
/* Lock an XID (used to wait for a transaction to finish) */
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void XactLockTableInsert(TransactionId xid);
|
2004-09-16 18:58:44 +02:00
|
|
|
extern void XactLockTableDelete(TransactionId xid);
|
1998-12-15 13:47:01 +01:00
|
|
|
extern void XactLockTableWait(TransactionId xid);
|
2005-08-01 22:31:16 +02:00
|
|
|
extern bool ConditionalXactLockTableWait(TransactionId xid);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2005-04-30 21:03:33 +02:00
|
|
|
/* Lock a general object (other than a relation) of the current database */
|
|
|
|
extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,
|
2005-10-15 04:49:52 +02:00
|
|
|
LOCKMODE lockmode);
|
2005-04-30 21:03:33 +02:00
|
|
|
extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,
|
2005-10-15 04:49:52 +02:00
|
|
|
LOCKMODE lockmode);
|
2005-04-30 21:03:33 +02:00
|
|
|
|
|
|
|
/* Lock a shared-across-databases object (other than a relation) */
|
|
|
|
extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid,
|
2005-10-15 04:49:52 +02:00
|
|
|
LOCKMODE lockmode);
|
2005-04-30 21:03:33 +02:00
|
|
|
extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid,
|
2005-10-15 04:49:52 +02:00
|
|
|
LOCKMODE lockmode);
|
2005-04-30 21:03:33 +02:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* LMGR_H */
|