| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Rpc.Server.Internal.Reflection
Description
Handler for the gRPC Server Reflection API
(https://github.com/grpc/grpc/blob/master/doc/server-reflection.md),
grpc.reflection.v1 and the older grpc.reflection.v1alpha. This lets
generic clients (e.g. grpcurl) discover and decode this server's proto
services without a local copy of the .proto files.
Synopsis
- serverReflectionInfoMethodV1 :: MonadIO m => [Text] -> IO (NextElem (Proto ServerReflectionRequest)) -> (NextElem (Proto ServerReflectionResponse) -> IO ()) -> m ()
- serverReflectionInfoMethodV1alpha :: MonadIO m => [Text] -> IO (NextElem (Proto ServerReflectionRequest)) -> (NextElem (Proto ServerReflectionResponse) -> IO ()) -> m ()
- answerReflectionRequest :: DescriptorTable -> [Text] -> Proto ServerReflectionRequest -> Proto ServerReflectionResponse
- qualifiedServiceName :: Service s => Text
Documentation
serverReflectionInfoMethodV1 Source #
Arguments
| :: MonadIO m | |
| => [Text] | Fully qualified names of every service registered with this server,
answered verbatim for |
| -> IO (NextElem (Proto ServerReflectionRequest)) | |
| -> (NextElem (Proto ServerReflectionResponse) -> IO ()) | |
| -> m () |
Handle the ServerReflectionInfo bidirectional stream for
grpc.reflection.v1: answer every request on the incoming stream in
turn, then forward the client's own terminal marker. A bidi handler that
returns without sending NoNextElem itself has its stream cancelled
instead of closed with trailers, the same requirement as for
server-streaming handlers (both go through grapesy's identical
sendOutput call . fromNextElem call path).
serverReflectionInfoMethodV1alpha Source #
Arguments
| :: MonadIO m | |
| => [Text] | Fully qualified names of every service registered with this server,
answered verbatim for |
| -> IO (NextElem (Proto ServerReflectionRequest)) | |
| -> (NextElem (Proto ServerReflectionResponse) -> IO ()) | |
| -> m () |
Handle the same stream for the legacy grpc.reflection.v1alpha, by
bridging each message to and from v1 and answering with the one core
answerReflectionRequest.
answerReflectionRequest :: DescriptorTable -> [Text] -> Proto ServerReflectionRequest -> Proto ServerReflectionResponse Source #
Answer one ServerReflectionRequest, dispatching on its
message_request oneof.
Lookup failures (FileByFilename, FileContainingSymbol) are
reported in-stream as an ErrorResponse with NOT_FOUND, never as a
gRPC error: the RPC itself stays OK for the life of the stream.
No proto file served here declares proto2 extensions, so
file_containing_extension always answers NOT_FOUND, while
all_extension_numbers_of_type answers an empty ExtensionNumberResponse
for a type the server knows and NOT_FOUND for one it does not.
qualifiedServiceName :: Service s => Text Source #
The fully qualified name of a proto service, <package>.<Service>,
read off its own compiled-in descriptor via proto-lens's Service class.
Deriving it this way, rather than writing out the string, means the name
paired with each service's handler in Cardano.Rpc.Server and the name
answerReflectionRequest (above) advertises for list_services can
never drift apart.