• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The gRPC Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""AsyncIO version of Channelz servicer."""
15
16from grpc.experimental import aio
17
18import grpc_channelz.v1.channelz_pb2 as _channelz_pb2
19import grpc_channelz.v1.channelz_pb2_grpc as _channelz_pb2_grpc
20from grpc_channelz.v1._servicer import ChannelzServicer as _SyncChannelzServicer
21
22
23class ChannelzServicer(_channelz_pb2_grpc.ChannelzServicer):
24    """AsyncIO servicer for handling RPCs for service statuses."""
25
26    @staticmethod
27    async def GetTopChannels(request: _channelz_pb2.GetTopChannelsRequest,
28                             context: aio.ServicerContext
29                            ) -> _channelz_pb2.GetTopChannelsResponse:
30        return _SyncChannelzServicer.GetTopChannels(request, context)
31
32    @staticmethod
33    async def GetServers(request: _channelz_pb2.GetServersRequest,
34                         context: aio.ServicerContext
35                        ) -> _channelz_pb2.GetServersResponse:
36        return _SyncChannelzServicer.GetServers(request, context)
37
38    @staticmethod
39    async def GetServer(request: _channelz_pb2.GetServerRequest,
40                        context: aio.ServicerContext
41                       ) -> _channelz_pb2.GetServerResponse:
42        return _SyncChannelzServicer.GetServer(request, context)
43
44    @staticmethod
45    async def GetServerSockets(request: _channelz_pb2.GetServerSocketsRequest,
46                               context: aio.ServicerContext
47                              ) -> _channelz_pb2.GetServerSocketsResponse:
48        return _SyncChannelzServicer.GetServerSockets(request, context)
49
50    @staticmethod
51    async def GetChannel(request: _channelz_pb2.GetChannelRequest,
52                         context: aio.ServicerContext
53                        ) -> _channelz_pb2.GetChannelResponse:
54        return _SyncChannelzServicer.GetChannel(request, context)
55
56    @staticmethod
57    async def GetSubchannel(request: _channelz_pb2.GetSubchannelRequest,
58                            context: aio.ServicerContext
59                           ) -> _channelz_pb2.GetSubchannelResponse:
60        return _SyncChannelzServicer.GetSubchannel(request, context)
61
62    @staticmethod
63    async def GetSocket(request: _channelz_pb2.GetSocketRequest,
64                        context: aio.ServicerContext
65                       ) -> _channelz_pb2.GetSocketResponse:
66        return _SyncChannelzServicer.GetSocket(request, context)
67