Skip to content

Commit

Permalink
Add GetServiceInfo to xds.GRPCServer (#4507)
Browse files Browse the repository at this point in the history
  • Loading branch information
amenzhinsky committed Jun 9, 2021
1 parent aa1169a commit 95e48a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xds/server.go
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions xds/server_test.go
Expand Up @@ -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{}),
Expand Down

0 comments on commit 95e48a8

Please sign in to comment.