Skip to content

Commit cc7cb1a

Browse files
committed
Add stm.h
1 parent 3157940 commit cc7cb1a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

contrib/pg_gtm/stm.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
typedef struct OpaqueSnapshot* Snapshot;
2+
3+
typedef struct
4+
{
5+
void (*StartTransaction)(); // xact.c:StartTransacton
6+
void (*CommitTransaction)(); // xact.c:CommitTransacton
7+
void (*AbortTransaction)(); // xact.c:AbortTransacton
8+
void (*CleanupTransaction)(); // xact.c:CleanupTransacton
9+
10+
void (*StartSubTransaction)(); // xact.c:StartSubTransacton
11+
void (*CommitSubTransaction)(); // xact.c:CommitSubTransacton
12+
void (*AbortSubTransaction)(); // xact.c:CommitTSubransacton
13+
void (*CleanupSubTransaction)(); // xact.c:CleanupSubTransacton
14+
15+
void (*PushTransaction)(); // xact.c:PushTransaction
16+
void (*PopTransaction)(); // xact.c:PopTransaction
17+
18+
void (*PrepareTransaction)(char *gid ); // xact.c:PrepareTransacton
19+
20+
void (*AssignTransactionId)();// xact.c:AssignTransactionId
21+
TransactionId (*GetCurrentTransactionId)(); // xact.c:GetCurrentTransactionId
22+
TransactionId (*GetNextTransactionId)(); // varsup.c:ReadNewTransactionId
23+
24+
bool (*IsCommitted)(TransactionId xid); // transam.c:TransactionIdDidCommit
25+
bool (*IsAborted)(TransactionId xid); // transam.c:TransactionIdDidAbort
26+
bool (*IsCompleted)(TransactionId xid); // transam.c:TransactionIdIsKnownCompleted
27+
28+
// Do we need them?
29+
// Seems to be encapsulated by Commit/Rollback, but may be convenient to redefine just these functions
30+
void (*MarkCommitted)(TransactionId xid, int nxids, TransactionId *xids); // transam.c:TransactionIdCommitTree
31+
void (*AsyncMarkCommitted)(TransactionId xid, int nxids, TransactionId *xids, XLogRecPtr lsn)); // transam.c:TransactionIdAsyncCommitTree
32+
void (*MarkAborted)(TransactionId xid, int nxids, TransactionId *xids); // transam.c:TransactionIdAbortTree
33+
34+
XLogRecPtr (*GetCommitLSN)(TransactionId xid); // transam.c:TransactionIdGetCommitLSN
35+
} TransactionManager;
36+
37+
// tqual.c
38+
typedef struct
39+
{
40+
Snapshot (*AllocateSnapshot)(); // need to create snapshotы dynbamically
41+
42+
bool (*HeapTupleSatisfiesMVCC)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
43+
bool (*HeapTupleSatisfiesSelf)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
44+
bool (*HeapTupleSatisfiesDirty)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
45+
bool (*HeapTupleSatisfiesUpdate)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
46+
bool (*HeapTupleSatisfiesVacuum)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
47+
bool (*HeapTupleSatisfiesAny)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
48+
bool (*HeapTupleSatisfiesToast)(HeapTuple htup, Snapshot snapshot, Buffer buffer);
49+
50+
bool (*IsInProgress)(TransactionId xid, Snaphot snapshot); // XidInMVCCSnapshot
51+
} SnapshotManager;

0 commit comments

Comments
 (0)