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

Method RegisterDataplane

api/control_plane_api_server.go:232–251  ·  view source on GitHub ↗
(ctx context.Context, in *proto.DataplaneInfo)

Source from the content-addressed store, hash-verified

230}
231
232func (c *CpApiServer) RegisterDataplane(ctx context.Context, in *proto.DataplaneInfo) (*proto.ActionStatus, error) {
233 if !c.LeaderElectionServer.IsLeader() {
234 leader := c.LeaderElectionServer.GetLeader()
235
236 if leader != nil {
237 logrus.Warn("Received RegisterDataplane call although not the leader. Forwarding the call...")
238 return leader.RegisterDataplane(ctx, in)
239 } else {
240 return &proto.ActionStatus{Success: false}, nil
241 }
242 }
243
244 status, err, isHeartbeat := c.ControlPlane.RegisterDataplane(ctx, in)
245 if status.Success && err == nil && !isHeartbeat {
246 c.HAProxyAPI.AddDataplane(in.IP, int(in.ProxyPort), true)
247 c.DisseminateHAProxyConfig()
248 }
249
250 return status, err
251}
252
253func (c *CpApiServer) DeregisterDataplane(ctx context.Context, in *proto.DataplaneInfo) (*proto.ActionStatus, error) {
254 if !c.LeaderElectionServer.IsLeader() {

Callers

nothing calls this directly

Calls 5

GetLeaderMethod · 0.80
AddDataplaneMethod · 0.80
RegisterDataplaneMethod · 0.65
IsLeaderMethod · 0.45

Tested by

no test coverage detected