package server import ( pb "FRMS/internal/pkg/grpc" "FRMS/internal/pkg/logging" "context" ) // ClientDiscoveryHandler implements the grpc method which can be called // by incoming clients to first make connection to the central // coordinator and receive database credentials. func (c *Coordinator) ReactorClientHandler( ctx context.Context, req *pb.ReactorClientRequest, ) (*pb.ReactorClientResponse, error) { id := int(req.GetId()) logging.Debug( logging.DClient, "LIS 00 reactor %v has connected\n", id, ) db, err := c.getReactorDatabaseCred(id) if err != nil { return &pb.ReactorClientResponse{}, err } return &pb.ReactorClientResponse{ Id: id, Url: db.url, Org: db.org, Token: db.token, Bucket: db.bucket, }, err } // ReactorStatusHandler is a gRPC handler used to handle incoming // reactor requests containing information about said reactor. // It will get the associate reactor manager and pass the // request device information before returning an acknowledgement. func (c *Coordinator) ReactorStatusHandler(ctx context.Context, req *pb.ReactorStatusPing) (*pb.ReactorStatusResponse, error) { // rm, err := c.LoadReactorManager(int(req.GetId())) return &pb.ReactorStatusResponse{}, nil }