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

Method RegisterService

api/control_plane_api_server.go:202–215  ·  view source on GitHub ↗
(ctx context.Context, serviceInfo *proto.ServiceInfo)

Source from the content-addressed store, hash-verified

200}
201
202func (c *CpApiServer) RegisterService(ctx context.Context, serviceInfo *proto.ServiceInfo) (*proto.ActionStatus, error) {
203 if !c.LeaderElectionServer.IsLeader() {
204 leader := c.LeaderElectionServer.GetLeader()
205
206 if leader != nil {
207 logrus.Warn("Received RegisterService call although not the leader. Forwarding the call...")
208 return leader.RegisterService(ctx, serviceInfo)
209 } else {
210 return &proto.ActionStatus{Success: false}, nil
211 }
212 }
213
214 return c.ControlPlane.RegisterService(ctx, serviceInfo)
215}
216
217func (c *CpApiServer) DeregisterService(ctx context.Context, serviceInfo *proto.ServiceInfo) (*proto.ActionStatus, error) {
218 if !c.LeaderElectionServer.IsLeader() {

Callers

nothing calls this directly

Calls 3

GetLeaderMethod · 0.80
RegisterServiceMethod · 0.65
IsLeaderMethod · 0.45

Tested by

no test coverage detected