예제 #1
0
func NewTopologyWriter(topology *server.Topology, lc *client.LocalConnection, cm *ConnectionManager) *TopologyWriter {
	return &TopologyWriter{
		toWrite:           topology.Clone(),
		localConnection:   lc,
		connectionManager: cm,
		finished:          false,
	}
}
예제 #2
0
func (cm *ConnectionManager) updateTopology(topology *server.Topology) {
	if cm.topology.Equal(topology) {
		return
	}
	rmEq := cm.topology != nil && cm.topology.AllRMs.Equal(topology.AllRMs)
	// Even if no semantic change, the DBVersion/TxnId may have
	// changed, so we must update our cache.
	cm.topology = topology.Clone()
	if rmEq {
		return
	}
	server.Log("Topology change:", topology)
	rmToServerCopy := cm.cloneRMToServer()
	for _, cconn := range cm.connCountToClient {
		cconn.TopologyChange(topology, rmToServerCopy)
	}
}