From f30caa90add585c4778cc480700acd755ea2c1f7 Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Fri, 14 Aug 2020 10:26:20 -0700 Subject: [PATCH] server: Add ServiceRegistrar interface. (#3816) --- server.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server.go b/server.go index 867b012de..85beec413 100644 --- a/server.go +++ b/server.go @@ -540,6 +540,18 @@ func (s *Server) errorf(format string, a ...interface{}) { } } +// ServiceRegistrar wraps a single method that supports service registration. It +// enables users to pass concrete types other than grpc.Server to the service +// registration methods exported by the IDL generated code. +type ServiceRegistrar interface { + // RegisterService registers a service and its implementation to the + // concrete type implementing this interface. It may not be called + // once the server has started serving. + // desc describes the service and its methods and handlers. impl is the + // service implementation which is passed to the method handlers. + RegisterService(desc *ServiceDesc, impl interface{}) +} + // RegisterService registers a service and its implementation to the gRPC // server. It is called from the IDL generated code. This must be called before // invoking Serve.