MCPcopy Create free account
hub / github.com/apecloud/myduckserver / NewLogicalReplicator

Function NewLogicalReplicator

pgserver/logrepl/replication.go:64–75  ·  view source on GitHub ↗

NewLogicalReplicator creates a new logical replicator instance which connects to the primary and replication databases using the connection strings provided. The connection to the replica is established immediately, and the connection to the primary is established when StartReplication is called.

(subscription, primaryDns string)

Source from the content-addressed store, hash-verified

62// databases using the connection strings provided. The connection to the replica is established immediately, and the
63// connection to the primary is established when StartReplication is called.
64func NewLogicalReplicator(subscription, primaryDns string) (*LogicalReplicator, error) {
65 return &LogicalReplicator{
66 subscription: subscription,
67 primaryDns: primaryDns,
68 flushInterval: 200 * time.Millisecond,
69 mu: &sync.Mutex{},
70 logger: logrus.WithFields(logrus.Fields{
71 "component": "replicator",
72 "protocol": "pg",
73 }),
74 }, nil
75}
76
77// PrimaryDns returns the DNS for the primary database. Not suitable for RPCs used in replication e.g.
78// StartReplication. See ReplicationDns.

Callers 2

newReplicatorFunction · 0.92
UpdateSubscriptionsFunction · 0.85

Calls

no outgoing calls

Tested by 1

newReplicatorFunction · 0.74