1 /*
2  * clog.h
3  *
4  * PostgreSQL transaction-commit-log manager
5  *
6  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/access/clog.h
10  */
11 #ifndef CLOG_H
12 #define CLOG_H
13 
14 #include "access/xlogreader.h"
15 #include "lib/stringinfo.h"
16 
17 /*
18  * Possible transaction statuses --- note that all-zeroes is the initial
19  * state.
20  *
21  * A "subcommitted" transaction is a committed subtransaction whose parent
22  * hasn't committed or aborted yet.
23  */
24 typedef int XidStatus;
25 
26 #define TRANSACTION_STATUS_IN_PROGRESS		0x00
27 #define TRANSACTION_STATUS_COMMITTED		0x01
28 #define TRANSACTION_STATUS_ABORTED			0x02
29 #define TRANSACTION_STATUS_SUB_COMMITTED	0x03
30 
31 
32 extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
33 				   TransactionId *subxids, XidStatus status, XLogRecPtr lsn);
34 extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn);
35 
36 extern Size CLOGShmemBuffers(void);
37 extern Size CLOGShmemSize(void);
38 extern void CLOGShmemInit(void);
39 extern void BootStrapCLOG(void);
40 extern void StartupCLOG(void);
41 extern void TrimCLOG(void);
42 extern void ShutdownCLOG(void);
43 extern void CheckPointCLOG(void);
44 extern void ExtendCLOG(TransactionId newestXact);
45 extern void TruncateCLOG(TransactionId oldestXact);
46 
47 /* XLOG stuff */
48 #define CLOG_ZEROPAGE		0x00
49 #define CLOG_TRUNCATE		0x10
50 
51 extern void clog_redo(XLogReaderState *record);
52 extern void clog_desc(StringInfo buf, XLogReaderState *record);
53 extern const char *clog_identify(uint8 info);
54 
55 #endif   /* CLOG_H */
56