mirror of https://github.com/grpc/grpc-go.git
Minor fixes
This commit is contained in:
parent
26d2db5487
commit
078c90026f
14
server.go
14
server.go
|
@ -82,7 +82,7 @@ type service struct {
|
|||
server interface{} // the server for service methods
|
||||
md map[string]*MethodDesc
|
||||
sd map[string]*StreamDesc
|
||||
meta interface{}
|
||||
mdata interface{}
|
||||
}
|
||||
|
||||
// Server is a gRPC server to serve RPC requests.
|
||||
|
@ -232,7 +232,7 @@ func (s *Server) register(sd *ServiceDesc, ss interface{}) {
|
|||
server: ss,
|
||||
md: make(map[string]*MethodDesc),
|
||||
sd: make(map[string]*StreamDesc),
|
||||
meta: sd.Metadata,
|
||||
mdata: sd.Metadata,
|
||||
}
|
||||
for i := range sd.Methods {
|
||||
d := &sd.Methods[i]
|
||||
|
@ -247,12 +247,14 @@ func (s *Server) register(sd *ServiceDesc, ss interface{}) {
|
|||
|
||||
// ServiceInfo contains method names and metadata for a service.
|
||||
type ServiceInfo struct {
|
||||
Methods []string
|
||||
// Methods are method names only, without the service name or package name.
|
||||
Methods []string
|
||||
// Metadata is the metadata specified in ServiceDesc when registering service.
|
||||
Metadata interface{}
|
||||
}
|
||||
|
||||
// GetServiceInfo returns a map from service name to ServiceInfo.
|
||||
// Service name includes the package name, in the form of <package>.<service>.
|
||||
// GetServiceInfo returns a map from service names to ServiceInfo.
|
||||
// Service names include the package names, in the form of <package>.<service>.
|
||||
func (s *Server) GetServiceInfo() map[string]*ServiceInfo {
|
||||
ret := make(map[string]*ServiceInfo)
|
||||
for n, srv := range s.m {
|
||||
|
@ -266,7 +268,7 @@ func (s *Server) GetServiceInfo() map[string]*ServiceInfo {
|
|||
|
||||
ret[n] = &ServiceInfo{
|
||||
Methods: methods,
|
||||
Metadata: srv.meta,
|
||||
Metadata: srv.mdata,
|
||||
}
|
||||
}
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue