File: txid.h

package info (click to toggle)
skytools 2.1.8-2.2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,980 kB
  • ctags: 1,543
  • sloc: sql: 6,635; python: 6,237; ansic: 2,799; makefile: 308; sh: 268
file content (49 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (4)
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_ */