MCPcopy Create free account
hub / github.com/eth-easl/dirigent / addServer

Method addServer

internal/data_plane/haproxy/manager.go:174–188  ·  view source on GitHub ↗
(ipAddress string, port int, transaction string, version int64)

Source from the content-addressed store, hash-verified

172}
173
174func (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
190func (api *API) addRegistrationServer(ipAddress string, port int, transaction string, version int64) {
191 name := fmt.Sprintf("%s%d", RegistrationServerPrefix, rand.Int())

Callers 2

AddDataplaneMethod · 0.95
genericReviseMethod · 0.95

Calls 4

persistServerMetadataMethod · 0.95
IntMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected