1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#ifndef _TXID_H_
#define _TXID_H_
#define MAX_INT64 0x7FFFFFFFFFFFFFFFLL
/* Use unsigned variant internally */
typedef uint64 txid;
typedef struct
{
int32 __varsz; /* should not be touched directly */
uint32 nxip;
txid xmin;
txid xmax;
txid xip[1];
} TxidSnapshot;
#define TXID_SNAPSHOT_SIZE(nxip) (offsetof(TxidSnapshot, xip) + sizeof(txid) * nxip)
typedef struct {
uint64 last_value;
uint64 epoch;
} TxidEpoch;
/* internal functions */
void txid_load_epoch(TxidEpoch *state, int try_write);
txid txid_convert_xid(TransactionId xid, TxidEpoch *state);
/* public functions */
Datum txid_current(PG_FUNCTION_ARGS);
Datum txid_current_snapshot(PG_FUNCTION_ARGS);
Datum txid_snapshot_in(PG_FUNCTION_ARGS);
Datum txid_snapshot_out(PG_FUNCTION_ARGS);
Datum txid_snapshot_recv(PG_FUNCTION_ARGS);
Datum txid_snapshot_send(PG_FUNCTION_ARGS);
Datum txid_snapshot_xmin(PG_FUNCTION_ARGS);
Datum txid_snapshot_xmax(PG_FUNCTION_ARGS);
Datum txid_snapshot_xip(PG_FUNCTION_ARGS);
Datum txid_visible_in_snapshot(PG_FUNCTION_ARGS);
Datum txid_snapshot_active(PG_FUNCTION_ARGS);
Datum txid_in_snapshot(PG_FUNCTION_ARGS);
Datum txid_not_in_snapshot(PG_FUNCTION_ARGS);
#endif /* _TXID_H_ */
|