Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
lmgr.h123 linesDownload Raw Back to storage
1/*-------------------------------------------------------------------------2 *3 * lmgr.h4 *	  POSTGRES lock manager definitions.5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/storage/lmgr.h11 *12 *-------------------------------------------------------------------------13 */14#ifndef LMGR_H15#define LMGR_H16 17#include "lib/stringinfo.h"18#include "storage/itemptr.h"19#include "storage/lock.h"20#include "utils/rel.h"21 22 23/* XactLockTableWait operations */24typedef enum XLTW_Oper25{26	XLTW_None,27	XLTW_Update,28	XLTW_Delete,29	XLTW_Lock,30	XLTW_LockUpdated,31	XLTW_InsertIndex,32	XLTW_InsertIndexUnique,33	XLTW_FetchUpdated,34	XLTW_RecheckExclusionConstr35} XLTW_Oper;36 37extern void RelationInitLockInfo(Relation relation);38 39/* Lock a relation */40extern void LockRelationOid(Oid relid, LOCKMODE lockmode);41extern void LockRelationId(LockRelId *relid, LOCKMODE lockmode);42extern bool ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode);43extern void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode);44extern void UnlockRelationOid(Oid relid, LOCKMODE lockmode);45 46extern void LockRelation(Relation relation, LOCKMODE lockmode);47extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode);48extern void UnlockRelation(Relation relation, LOCKMODE lockmode);49extern bool CheckRelationLockedByMe(Relation relation, LOCKMODE lockmode,50									bool orstronger);51extern bool LockHasWaitersRelation(Relation relation, LOCKMODE lockmode);52 53extern void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode);54extern void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode);55 56/* Lock a relation for extension */57extern void LockRelationForExtension(Relation relation, LOCKMODE lockmode);58extern void UnlockRelationForExtension(Relation relation, LOCKMODE lockmode);59extern bool ConditionalLockRelationForExtension(Relation relation,60												LOCKMODE lockmode);61extern int	RelationExtensionLockWaiterCount(Relation relation);62 63/* Lock to recompute pg_database.datfrozenxid in the current database */64extern void LockDatabaseFrozenIds(LOCKMODE lockmode);65 66/* Lock a page (currently only used within indexes) */67extern void LockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);68extern bool ConditionalLockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);69extern void UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode);70 71/* Lock a tuple (see heap_lock_tuple before assuming you understand this) */72extern void LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);73extern bool ConditionalLockTuple(Relation relation, ItemPointer tid,74								 LOCKMODE lockmode);75extern void UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode);76 77/* Lock an XID (used to wait for a transaction to finish) */78extern void XactLockTableInsert(TransactionId xid);79extern void XactLockTableDelete(TransactionId xid);80extern void XactLockTableWait(TransactionId xid, Relation rel,81							  ItemPointer ctid, XLTW_Oper oper);82extern bool ConditionalXactLockTableWait(TransactionId xid);83 84/* Lock VXIDs, specified by conflicting locktags */85extern void WaitForLockers(LOCKTAG heaplocktag, LOCKMODE lockmode, bool progress);86extern void WaitForLockersMultiple(List *locktags, LOCKMODE lockmode, bool progress);87 88/* Lock an XID for tuple insertion (used to wait for an insertion to finish) */89extern uint32 SpeculativeInsertionLockAcquire(TransactionId xid);90extern void SpeculativeInsertionLockRelease(TransactionId xid);91extern void SpeculativeInsertionWait(TransactionId xid, uint32 token);92 93/* Lock a general object (other than a relation) of the current database */94extern void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,95							   LOCKMODE lockmode);96extern bool ConditionalLockDatabaseObject(Oid classid, Oid objid,97										  uint16 objsubid, LOCKMODE lockmode);98extern void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid,99								 LOCKMODE lockmode);100 101/* Lock a shared-across-databases object (other than a relation) */102extern void LockSharedObject(Oid classid, Oid objid, uint16 objsubid,103							 LOCKMODE lockmode);104extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid,105							   LOCKMODE lockmode);106 107extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid,108									   LOCKMODE lockmode);109extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid,110										 LOCKMODE lockmode);111 112extern void LockApplyTransactionForSession(Oid suboid, TransactionId xid, uint16 objid,113										   LOCKMODE lockmode);114extern void UnlockApplyTransactionForSession(Oid suboid, TransactionId xid, uint16 objid,115											 LOCKMODE lockmode);116 117/* Describe a locktag for error messages */118extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag);119 120extern const char *GetLockNameFromTagType(uint16 locktag_type);121 122#endif							/* LMGR_H */123 
codekingpro/portable-devtools · Team Ai