New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: Add ServiceRegistrar interface. #3816
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -540,6 +540,20 @@ 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. | ||
// | ||
// This API is EXPERIMENTAL. | ||
type ServiceRegistrar interface { | ||
// RegisterService registers a service and its implementation to the | ||
// concrete type implementing this interface. It is called from the IDL | ||
// generated code. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // 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. (I think we can omit the bit about generated code here.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
// | ||
// This API is EXPERIMENTAL. | ||
RegisterService(*ServiceDesc, interface{}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name these parameters:
And document them above: // desc describes the service and its methods and handlers. impl is the service
// implementation which is passed to the method handers*. * - for some reason we can't explain. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
} | ||
|
||
// 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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be experimental if we use it in stable generated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ....
Done.