(ipAddress string, port int, transaction string, version int64)
| 172 | } |
| 173 | |
| 174 | func (api *API) addServer(ipAddress string, port int, transaction string, version int64) { |
| 175 | name := fmt.Sprintf("%s%d", DataplanePrefix, rand.Int()) |
| 176 | url := fmt.Sprintf("%s:%d", ipAddress, port) |
| 177 | |
| 178 | api.mutex.Lock() |
| 179 | defer api.mutex.Unlock() |
| 180 | |
| 181 | if _, ok := api.addressToName[url]; ok { |
| 182 | return |
| 183 | } else { |
| 184 | api.persistServerMetadata(name, ipAddress, port, transaction, version) |
| 185 | api.addressToName[url] = name |
| 186 | logrus.Infof("Added data plane with address %s:%d to HAProxy backend.", ipAddress, port) |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | func (api *API) addRegistrationServer(ipAddress string, port int, transaction string, version int64) { |
| 191 | name := fmt.Sprintf("%s%d", RegistrationServerPrefix, rand.Int()) |
no test coverage detected