-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from shabbyrobe/reflection-aio
Add support to reflection for aio server
- Loading branch information
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
import typing | ||
|
||
import grpc | ||
from grpc import aio | ||
from google.protobuf import descriptor_pool | ||
from grpc import Server, ServicerContext | ||
from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 | ||
from grpc_reflection.v1alpha._base import BaseReflectionServicer | ||
from typing import Iterable, List, Optional | ||
|
||
SERVICE_NAME: str | ||
|
||
AnyServer = typing.Union[grpc.Server, aio.Server] | ||
AnyServicerContext = typing.Union[grpc.ServicerContext, aio.ServicerContext] | ||
|
||
class ReflectionServicer(BaseReflectionServicer): | ||
def ServerReflectionInfo(self, request_iterator: Iterable[_reflection_pb2.ServerReflectionRequest], context: ServicerContext) -> None: | ||
def ServerReflectionInfo( | ||
self, | ||
request_iterator: typing.Iterable[_reflection_pb2.ServerReflectionRequest], | ||
context: AnyServicerContext, | ||
) -> None: | ||
... | ||
|
||
def enable_server_reflection(service_names: List[str], server: Server, pool: Optional[descriptor_pool.DescriptorPool] = ...) -> None: | ||
def enable_server_reflection( | ||
service_names: typing.List[str], | ||
server: AnyServer, | ||
pool: typing.Optional[descriptor_pool.DescriptorPool] = ..., | ||
) -> None: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
black | ||
pytest-mypy-plugins==1.10.1 | ||
mypy>=0.902 | ||
types-protobuf | ||
twine | ||
wheel | ||
-e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters