MCPcopy
hub / github.com/grpc/grpc-go / GetServiceInfo

Method GetServiceInfo

server.go:827–852  ·  view source on GitHub ↗

GetServiceInfo returns a map from service names to ServiceInfo. Service names include the package names, in the form of <package>.<service>.

()

Source from the content-addressed store, hash-verified

825// GetServiceInfo returns a map from service names to ServiceInfo.
826// Service names include the package names, in the form of <package>.<service>.
827func (s *Server) GetServiceInfo() map[string]ServiceInfo {
828 ret := make(map[string]ServiceInfo)
829 for n, srv := range s.services {
830 methods := make([]MethodInfo, 0, len(srv.methods)+len(srv.streams))
831 for m := range srv.methods {
832 methods = append(methods, MethodInfo{
833 Name: m,
834 IsClientStream: false,
835 IsServerStream: false,
836 })
837 }
838 for m, d := range srv.streams {
839 methods = append(methods, MethodInfo{
840 Name: m,
841 IsClientStream: d.ClientStreams,
842 IsServerStream: d.ServerStreams,
843 })
844 }
845
846 ret[n] = ServiceInfo{
847 Methods: methods,
848 Metadata: srv.mdata,
849 }
850 }
851 return ret
852}
853
854// ErrServerStopped indicates that the operation is now illegal because of
855// the server being stopped.

Callers 1

TestGetServiceInfoMethod · 0.95

Calls

no outgoing calls

Tested by 1

TestGetServiceInfoMethod · 0.76