-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdef.go
66 lines (51 loc) · 1.24 KB
/
def.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package postgres
import (
"log"
"os"
"github.com/jackc/pglogrepl"
)
const (
LOGGER_PREFIX string = "[lib-postgres-stream] "
__SQL_SELECT_REPLICATION_SLOT string = `
SELECT slot_name,
plugin,
slot_type,
database,
temporary,
active,
restart_lsn,
confirmed_flush_lsn
FROM "pg_catalog"."pg_replication_slots"
WHERE slot_name IN (%s);`
__PG_ERRCODE_DUPLICATE_OBJECT = "42710"
StreamZeroOffset string = "0"
StreamNeverDeliveredOffset string = ">"
StreamUnspecifiedOffset string = ""
)
const (
LogicalReplication = pglogrepl.LogicalReplication
PhysicalReplication = pglogrepl.PhysicalReplication
Wal2JsonPlugin = "wal2json"
)
var (
defaultLogger *log.Logger = log.New(os.Stdout, LOGGER_PREFIX, log.LstdFlags|log.Lmsgprefix)
)
type (
LSN = pglogrepl.LSN
ReplicationMode = pglogrepl.ReplicationMode
MessageHandleProc func(message *Message)
EventHandleProc func(event Event) error
ErrorHandleProc func(err error) (disposed bool)
MessageDelegate interface {
OnAck(msg *Message)
}
Event interface {
ByteID() byte
}
SlotOffsetInfo interface {
getSlotOffset() SlotOffset
}
ReplicationOption interface {
applyStartReplicationOptions(opt *pglogrepl.StartReplicationOptions)
}
)