Lets say that my given GRPC endpoint has the following implementation
type HandlerFunc func(ctx context.Context, in *pb.Request) (*pb.Response, error)
func newHandler() HandlerFunc {
func (s *Server) Process(ctx context.Context, in *pb.Request) (*pb.Response, error) {
//do processing
}
}
type Server struct {
Handler handler
}
func new() (s *Server) {
return &Server{
handler: handlers.newHandler()
}
}
func (s *Server) Process(ctx context.Context, in *pb.Request) (*pb.Response, error) {
return s.handler
}
Now lets say that multiple clients try to call the Process endpoint. Do all of them call the same Process function of the same instance of the server or they call the Process function of the different instance of the server?
Also the handler defined in
func newHandler() HandlerFunc {
func (s *Server) Process(ctx context.Context, in *pb.Request) (*pb.Response, error) {
//do processing
}
}
Is the same instance of the handler handling multiple requests from the same client? Also how about different clients? Is the same instance of the handler handling requests from multiple clients?