forked from pganalyze/collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostgres_server_stats.go
38 lines (31 loc) · 1.53 KB
/
postgres_server_stats.go
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
package state
// PostgresServerStats - Statistics for a Postgres server.
type PostgresServerStats struct {
CurrentXactId Xid8
NextMultiXactId Xid8
XminHorizonBackend Xid
XminHorizonReplicationSlot Xid
XminHorizonReplicationSlotCatalog Xid
XminHorizonPreparedXact Xid
XminHorizonStandby Xid
}
// FullXminHorizonBackend - Returns XminHorizonBackend in 64-bit FullTransactionId
func (ss PostgresServerStats) FullXminHorizonBackend() int64 {
return int64(XidToXid8(ss.XminHorizonBackend, Xid8(ss.CurrentXactId)))
}
// FullXminHorizonReplicationSlot - Returns XminHorizonReplicationSlot in 64-bit FullTransactionId
func (ss PostgresServerStats) FullXminHorizonReplicationSlot() int64 {
return int64(XidToXid8(ss.XminHorizonReplicationSlot, Xid8(ss.CurrentXactId)))
}
// FullXminHorizonReplicationSlotCatalog - Returns XminHorizonReplicationSlotCatalog in 64-bit FullTransactionId
func (ss PostgresServerStats) FullXminHorizonReplicationSlotCatalog() int64 {
return int64(XidToXid8(ss.XminHorizonReplicationSlotCatalog, Xid8(ss.CurrentXactId)))
}
// FullXminHorizonPreparedXact - Returns XminHorizonPreparedXact in 64-bit FullTransactionId
func (ss PostgresServerStats) FullXminHorizonPreparedXact() int64 {
return int64(XidToXid8(ss.XminHorizonPreparedXact, Xid8(ss.CurrentXactId)))
}
// FullXminHorizonStandby - Returns XminHorizonStandby in 64-bit FullTransactionId
func (ss PostgresServerStats) FullXminHorizonStandby() int64 {
return int64(XidToXid8(ss.XminHorizonStandby, Xid8(ss.CurrentXactId)))
}