Add GetServiceInfo to xds.GRPCServer (#4507)

This commit is contained in:
Aliaksandr Mianzhynski 2021-06-09 21:05:17 +03:00 committed by GitHub
parent aa1169ab7c
commit 95e48a892d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,7 @@ type grpcServer interface {
Serve(net.Listener) error
Stop()
GracefulStop()
GetServiceInfo() map[string]grpc.ServiceInfo
}
// GRPCServer wraps a gRPC server and provides server-side xDS functionality, by
@ -136,6 +137,12 @@ func (s *GRPCServer) RegisterService(sd *grpc.ServiceDesc, ss interface{}) {
s.gs.RegisterService(sd, ss)
}
// GetServiceInfo returns a map from service names to ServiceInfo.
// Service names include the package names, in the form of <package>.<service>.
func (s *GRPCServer) GetServiceInfo() map[string]grpc.ServiceInfo {
return s.gs.GetServiceInfo()
}
// initXDSClient creates a new xdsClient if there is no existing one available.
func (s *GRPCServer) initXDSClient() error {
s.clientMu.Lock()

View File

@ -86,6 +86,10 @@ func (f *fakeGRPCServer) GracefulStop() {
f.gracefulStopCh.Send(nil)
}
func (f *fakeGRPCServer) GetServiceInfo() map[string]grpc.ServiceInfo {
panic("implement me")
}
func newFakeGRPCServer() *fakeGRPCServer {
return &fakeGRPCServer{
done: make(chan struct{}),