-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathpgcapture.go
45 lines (37 loc) · 1.18 KB
/
pgcapture.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
package pgcapture
import (
"context"
"github.com/replicase/pgcapture/pkg/dblog"
"github.com/replicase/pgcapture/pkg/pb"
"github.com/replicase/pgcapture/pkg/pgcapture"
"github.com/replicase/pgcapture/pkg/source"
"google.golang.org/grpc"
)
var (
CommitSHA string
Version string
)
type (
Model = pgcapture.Model
Change = pgcapture.Change
ModelHandlerFunc = pgcapture.ModelHandlerFunc
ConsumerOption = pgcapture.ConsumerOption
SourceResolver = dblog.SourceResolver
SourceDumper = dblog.SourceDumper
RequeueSource = source.RequeueSource
)
func NewDBLogConsumer(ctx context.Context, conn *grpc.ClientConn, option ConsumerOption) *pgcapture.Consumer {
return pgcapture.NewDBLogConsumer(ctx, conn, option)
}
func NewDBLogGateway(conn *grpc.ClientConn, sourceResolver SourceResolver) *dblog.Gateway {
return &dblog.Gateway{
SourceResolver: sourceResolver,
DumpInfoPuller: &dblog.GRPCDumpInfoPuller{Client: pb.NewDBLogControllerClient(conn)},
}
}
func NewDBLogControllerClient(conn *grpc.ClientConn) pb.DBLogControllerClient {
return pb.NewDBLogControllerClient(conn)
}
func MarshalJSON(m Model) ([]byte, error) {
return pgcapture.MarshalJSON(m)
}