• 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(
28            request: _channelz_pb2.GetTopChannelsRequest,
29            context: aio.ServicerContext
30    ) -> _channelz_pb2.GetTopChannelsResponse:
31        return _SyncChannelzServicer.GetTopChannels(request, context)
32
33    @staticmethod
34    async def GetServers(
35            request: _channelz_pb2.GetServersRequest,
36            context: aio.ServicerContext) -> _channelz_pb2.GetServersResponse:
37        return _SyncChannelzServicer.GetServers(request, context)
38
39    @staticmethod
40    async def GetServer(
41            request: _channelz_pb2.GetServerRequest,
42            context: aio.ServicerContext) -> _channelz_pb2.GetServerResponse:
43        return _SyncChannelzServicer.GetServer(request, context)
44
45    @staticmethod
46    async def GetServerSockets(
47            request: _channelz_pb2.GetServerSocketsRequest,
48            context: aio.ServicerContext
49    ) -> _channelz_pb2.GetServerSocketsResponse:
50        return _SyncChannelzServicer.GetServerSockets(request, context)
51
52    @staticmethod
53    async def GetChannel(
54            request: _channelz_pb2.GetChannelRequest,
55            context: aio.ServicerContext) -> _channelz_pb2.GetChannelResponse:
56        return _SyncChannelzServicer.GetChannel(request, context)
57
58    @staticmethod
59    async def GetSubchannel(
60            request: _channelz_pb2.GetSubchannelRequest,
61            context: aio.ServicerContext
62    ) -> _channelz_pb2.GetSubchannelResponse:
63        return _SyncChannelzServicer.GetSubchannel(request, context)
64
65    @staticmethod
66    async def GetSocket(
67            request: _channelz_pb2.GetSocketRequest,
68            context: aio.ServicerContext) -> _channelz_pb2.GetSocketResponse:
69        return _SyncChannelzServicer.GetSocket(request, context)
70