|
| 1 | +// |
| 2 | +// DO NOT EDIT. |
| 3 | +// swift-format-ignore-file |
| 4 | +// |
| 5 | +// Generated by the protocol buffer compiler. |
| 6 | +// Source: reflection.proto |
| 7 | +// |
| 8 | +import GRPC |
| 9 | +import NIO |
| 10 | +import NIOConcurrencyHelpers |
| 11 | +import SwiftProtobuf |
| 12 | + |
| 13 | + |
| 14 | +/// To build a server, implement a class that conforms to this protocol. |
| 15 | +internal protocol Reflection_ServerReflectionProvider: CallHandlerProvider { |
| 16 | + var interceptors: Reflection_ServerReflectionServerInterceptorFactoryProtocol? { get } |
| 17 | + |
| 18 | + /// The reflection service is structured as a bidirectional stream, ensuring |
| 19 | + /// all related requests go to a single server. |
| 20 | + func serverReflectionInfo(context: StreamingResponseCallContext<Reflection_ServerReflectionResponse>) -> EventLoopFuture<(StreamEvent<Reflection_ServerReflectionRequest>) -> Void> |
| 21 | +} |
| 22 | + |
| 23 | +extension Reflection_ServerReflectionProvider { |
| 24 | + internal var serviceName: Substring { |
| 25 | + return Reflection_ServerReflectionServerMetadata.serviceDescriptor.fullName[...] |
| 26 | + } |
| 27 | + |
| 28 | + /// Determines, calls and returns the appropriate request handler, depending on the request's method. |
| 29 | + /// Returns nil for methods not handled by this service. |
| 30 | + internal func handle( |
| 31 | + method name: Substring, |
| 32 | + context: CallHandlerContext |
| 33 | + ) -> GRPCServerHandlerProtocol? { |
| 34 | + switch name { |
| 35 | + case "ServerReflectionInfo": |
| 36 | + return BidirectionalStreamingServerHandler( |
| 37 | + context: context, |
| 38 | + requestDeserializer: ProtobufDeserializer<Reflection_ServerReflectionRequest>(), |
| 39 | + responseSerializer: ProtobufSerializer<Reflection_ServerReflectionResponse>(), |
| 40 | + interceptors: self.interceptors?.makeServerReflectionInfoInterceptors() ?? [], |
| 41 | + observerFactory: self.serverReflectionInfo(context:) |
| 42 | + ) |
| 43 | + |
| 44 | + default: |
| 45 | + return nil |
| 46 | + } |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +/// To implement a server, implement an object which conforms to this protocol. |
| 51 | +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
| 52 | +internal protocol Reflection_ServerReflectionAsyncProvider: CallHandlerProvider, Sendable { |
| 53 | + static var serviceDescriptor: GRPCServiceDescriptor { get } |
| 54 | + var interceptors: Reflection_ServerReflectionServerInterceptorFactoryProtocol? { get } |
| 55 | + |
| 56 | + /// The reflection service is structured as a bidirectional stream, ensuring |
| 57 | + /// all related requests go to a single server. |
| 58 | + func serverReflectionInfo( |
| 59 | + requestStream: GRPCAsyncRequestStream<Reflection_ServerReflectionRequest>, |
| 60 | + responseStream: GRPCAsyncResponseStreamWriter<Reflection_ServerReflectionResponse>, |
| 61 | + context: GRPCAsyncServerCallContext |
| 62 | + ) async throws |
| 63 | +} |
| 64 | + |
| 65 | +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
| 66 | +extension Reflection_ServerReflectionAsyncProvider { |
| 67 | + internal static var serviceDescriptor: GRPCServiceDescriptor { |
| 68 | + return Reflection_ServerReflectionServerMetadata.serviceDescriptor |
| 69 | + } |
| 70 | + |
| 71 | + internal var serviceName: Substring { |
| 72 | + return Reflection_ServerReflectionServerMetadata.serviceDescriptor.fullName[...] |
| 73 | + } |
| 74 | + |
| 75 | + internal var interceptors: Reflection_ServerReflectionServerInterceptorFactoryProtocol? { |
| 76 | + return nil |
| 77 | + } |
| 78 | + |
| 79 | + internal func handle( |
| 80 | + method name: Substring, |
| 81 | + context: CallHandlerContext |
| 82 | + ) -> GRPCServerHandlerProtocol? { |
| 83 | + switch name { |
| 84 | + case "ServerReflectionInfo": |
| 85 | + return GRPCAsyncServerHandler( |
| 86 | + context: context, |
| 87 | + requestDeserializer: ProtobufDeserializer<Reflection_ServerReflectionRequest>(), |
| 88 | + responseSerializer: ProtobufSerializer<Reflection_ServerReflectionResponse>(), |
| 89 | + interceptors: self.interceptors?.makeServerReflectionInfoInterceptors() ?? [], |
| 90 | + wrapping: { try await self.serverReflectionInfo(requestStream: $0, responseStream: $1, context: $2) } |
| 91 | + ) |
| 92 | + |
| 93 | + default: |
| 94 | + return nil |
| 95 | + } |
| 96 | + } |
| 97 | +} |
| 98 | + |
| 99 | +internal protocol Reflection_ServerReflectionServerInterceptorFactoryProtocol: Sendable { |
| 100 | + |
| 101 | + /// - Returns: Interceptors to use when handling 'serverReflectionInfo'. |
| 102 | + /// Defaults to calling `self.makeInterceptors()`. |
| 103 | + func makeServerReflectionInfoInterceptors() -> [ServerInterceptor<Reflection_ServerReflectionRequest, Reflection_ServerReflectionResponse>] |
| 104 | +} |
| 105 | + |
| 106 | +internal enum Reflection_ServerReflectionServerMetadata { |
| 107 | + internal static let serviceDescriptor = GRPCServiceDescriptor( |
| 108 | + name: "ServerReflection", |
| 109 | + fullName: "reflection.ServerReflection", |
| 110 | + methods: [ |
| 111 | + Reflection_ServerReflectionServerMetadata.Methods.serverReflectionInfo, |
| 112 | + ] |
| 113 | + ) |
| 114 | + |
| 115 | + internal enum Methods { |
| 116 | + internal static let serverReflectionInfo = GRPCMethodDescriptor( |
| 117 | + name: "ServerReflectionInfo", |
| 118 | + path: "/reflection.ServerReflection/ServerReflectionInfo", |
| 119 | + type: GRPCCallType.bidirectionalStreaming |
| 120 | + ) |
| 121 | + } |
| 122 | +} |
0 commit comments