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)
| 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. |
| 64 | func 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. |
no outgoing calls