-
Notifications
You must be signed in to change notification settings - Fork 5
/
mocks.go
51 lines (44 loc) · 1.05 KB
/
mocks.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
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"time"
"gopkg.in/volatiletech/null.v6"
)
type fakeDataSource struct {
byteLag int64
}
func (fdr *fakeDataSource) Close() error {
return nil
}
func (fdr *fakeDataSource) GetNodeInfo() (*NodeInfo, error) {
return &NodeInfo{
State: 1,
PostmasterStartTime: "2020-11-12 10:55:55.073 EST",
Role: "primary",
Xlog: &XlogInfo{
Location: 137936246584,
ReceivedLocation: 137936246408,
ReplayedLocation: null.NewInt64(137936246408, true),
Paused: false,
},
ByteLag: fdr.byteLag,
}, nil
}
func (fdr *fakeDataSource) IsInRecovery() (bool, error) {
return false, nil
}
func (fdr *fakeDataSource) GetPgStatReplication() ([]*PgStatReplication, error) {
return []*PgStatReplication{
{
ApplicationName: "pghost_created_replication_slot",
FlushLag: time.Second,
},
}, nil
}
func (fdr *fakeDataSource) GetPgReplicationSlots() ([]*PgReplicationSlot, error) {
return []*PgReplicationSlot{
{
SlotName: "pghost_created_replication_slot",
Active: true,
},
}, nil
}